I just tried g npm_outdated undocumented Gradle task and got this result*:
> Task :npm_outdated
Package Current Wanted Latest Location
dompurify 2.3.3 2.3.4 2.3.4 ofbiz-framework
jquery 3.5.1 3.6.0 3.6.0 ofbiz-framework
jquery-migrate 3.3.1 3.3.2 3.3.2 ofbiz-framework
jquery-ui-dist 1.12.1 1.13.0 1.13.0 ofbiz-framework
This updates accordingly. I keep this task open as an umbrella tasks for similar
subtasks in future like we have OFBIZ-10213
Thanks: Jacques for inspiration and guidance, Aditya Sharma for sharing
thoughts and visions and Ingo Richter for finding this gem.
- changed grid 'EditProductPriceRulesCondition' list-name to reflect
correct list
This complete the previous Improvement, Rendering different HTML container types with ScreenRenderer (OFBIZ-10495), where the xml macro are forgotten.
In same time resynchronise also missing macro renderColumn*
Tentative to fix issues reported by SonarCloud:
Unexpected shorthand "margin" after "margin-right"
Unexpected duplicate "padding"
Also try changes for INFRA-22689
"No status emails sent to commits@ofbiz.apache.org"
After checking that we don't have any possible vulnerability using
jquery-ui-dist (ie 1.12.1) vs jquery-ui (1.13.0) based on* and checking in code
I decided to use jquery-ui-dist from npm. I just had to modify OfbizUtil.js to
get back to element.form() (for 1.12.1) vs element._form() for 1.13.0
I hope the npm jquery-ui-dist package will be updated soon. The release of
1.13.0 is quite fresh (<1 month).
We also need a mechanism to check the update or our npm packages.
As Aditya explained:
<<Minor updates can be handled implicitly by node when specified with tilde
range or caret range for version. For major updates, we just have to change
the version and use npm install.>>
So for now it will be manual. Later something like** could be used (I wonder
about https://snyk.io/, but that needs Infra agreement)
* https://blog.jqueryui.com/2021/10/jquery-ui-1-13-0-released/
** https://dev.to/dennismphil/automate-your-node-dependency-updates-4aga
Previously in commit dfc7ee4 I blindly followed GH CodeQL's advice about js CSS.
I had a doubt, indeed it was irrelevant. I misinterpreted the advice.
Then I tried to follow OWASP's advice about using node-esapi but was unable to
make it work in a reasonable time. Neither with "node require" nor requireJS;
ie using either CommonJS or AMD format, I guess I missed something there.
Anyway, I finally I set my sights on DOMPurify which is doing the job.
There is only one "foot-gun potential":
https://github.com/cure53/DOMPurify#user-content-is-there-any-foot-gun-potential
"If you first sanitize HTML and then modify it afterwards, you might easily void
the effects of sanitization. If you feed the sanitized markup to another library
after sanitization, please be certain that the library doesn't mess around with
the HTML on its own."
Fortunately, that's not a concern in our simple case.
This commit
* fixes the 3 remaining js vulnerabilty reported by
* prevents checking all under node_modules since it's done by npm in console
(a bit weak though, ie not clearly on purpose)
* gives more information about 'ci' vs 'install' in npmInstallCommand
Fixes "A DOM text reinterpreted as HTML" issue in fieldlookup.js
GH CodeQL reports:
"A webpage with this vulnerability reads text from the DOM, and afterwards adds
the text as HTML to the DOM. Using text from the DOM as HTML effectively
unescapes the text, and thereby invalidates any escaping done on the text. If an
attacker is able to control the safe sanitized text, then this vulnerability can
be exploited to perform a cross-site scripting attack.
Recommendation
To guard against cross-site scripting, consider using contextual output
encoding/escaping before writing text to the page, or one of the other solutions
that are mentioned in the References section below.
Example
"Extracting text from a DOM node and interpreting it as HTML can lead to a
cross-site scripting vulnerability."
GH CodeQL suggest:
The above vulnerability can be fixed by using $.find instead of $. The $.find
function will only interpret target as a CSS selector and never as HTML,
thereby preventing an XSS attack.
GH CodeQL reports 556 "Incomplete string escaping or encoding branch" issues
(there are 588 issues at all).
Most of them are in jQuery-UI but not only. So this only an attempt to clarify
among the 23 pages reported by upgrading jQuery-UI to 1.13.0.
As reported at https://markmail.org/message/uof5ldk4o3x2ya33 I did not spot that
I also needed to commit the checksum change.
There is maybe more to do related to using "npm ci" instead of "npm install",
I'll check it out.
Removed javascript for jQuery, jQuery Migrate, jQuery Browser and jQuery Validation from OFBiz sources. Instead these are now retrieved during the build as NPM packages using gradle-node-plugin.
Thanks: Aditya Sharma for implementation.
At https://markmail.org/message/inoihmcon37wq5zz I suggested:
If I'm not wrong, we no longer use Docbook anywhere. So I suggest to remove it
from:
1. cmssite component, where it was used by the online help, now assured by
Asciidoc. BTW, for whom it could concern, I noticed that anchors jumping
in adoc files does not work in online help
2. docbook.dtd in content component only used by the cmssite component
3. docbook.css in themes, I'm not sure that still useful there
Transform workEffort creation using modal and callback system to
illustrate this improvement.
A new Attribute `from-event-result` is created for `set-callback`
parameters, to indicate that the callback should be called with a
parameter which value comes from the event result initiated by the link.
In this example, is retrieved from the workeffort creation event the id
needed to display the WorkEffortSummary screen of the new data.
A new pattern is created to encode in CALLBACK JWT token the data that
should be parsed from the event. The parsing occurs in javascript.
Adding new method to display tooltip on overload when we have a mouse hover on icon information to reduce
text quantity for optional information.
Add some other improvement :
* remove bold on dynamic lookup return to avoid constant moving display
* escape error when on TopappBar if display apps are not present
Thanks to Marine Desmarchelier and Gil Portenseigne for their works
Thanks to Xin Wang comments in https://s.apache.org/trrkk we discover
that label retrieval through javascript are not working.
One example exists, but is not functionnal and do not use jgrowl.
This commit allow jgrowl use directly from javascript (showjGrowlMessage(...))
while making label retrieval synchronous for Jgrowl and fromDate/thruDate existing
feature.
Clean up showErrorAlertLoadUiLabel that became orphan.
Makes moz-linear-gradient the same than webkit-gradient. Both should be replaced
by linear-gradient but that's another issue...
Second try, based on search on Net
Some few improvement on Helveticus theme, where we add three other color red, yellow and green and increase the contrast on blue color.
Thanks to Marine Desmarchelier for this improvement
This prevented to run the stable demo, hence the next, weirdly the trunk had
not this problem. Anyway better safe than sorry... Maybe related to Gradle
version or rather libs loaded?
The reason why the stable (and old) demos were not running is because the
EntitySaxReaderTests did not pass
Replaces wrong bgcolor by background-color
This is not only for Helveticus but other themes as well. I guess it was a C/P
from the oldest theme
I checked I see no real change in any of themes. I decided to not backport.
Remain few other bugs in Helveticus.
Not really knowing Less, I'm not sure about the helveticus-main-theme.less ones.
I don't know either how to bypass "false" reports
After the refactoring realized on issue OFBIZ-12268, a typo has been introduce when we scanned the presence of error during an ajax call.
The typo raised that ignore the case of an error is present as list.
The same typo is also present for event message list.
Thanks to Xin Wang to alert on this problem through issue OFBIZ-12272
Menus link with request-confirmation and confirmation message do not generate the script that open confirmation
When you activate the following menu item :
<menu-item name="statusToCancelled" title="${uiLabelMap.AccountingPaymentTabStatusToCancelled}">
<link target="setPaymentStatus" request-confirmation="true" confirmation-message="You want to cancel this payment number ${payment.paymentId}?">
....
</link>
</menu-item>
OFBiz to not generate the js code link to the request-confirmation attribute because this functionality has been never implemented on java code for MenuRenderer
Thanks to Leila Mekika for raised this issue and solved it
If you use a ComomnDynamicSingle form for realize a search, the FindScreenDecorator would be refresh all the container searchOptions + searchResult.
To keep the coherence, we move the screenStack resolution on the beginning of the decorator, and leave the searchResult to resolve it itself by usage of EmbeddedDecorator.
In practice to keep all dynamism on a search element :
* Main screen with global decorator include the find screen wrap by main-decorator
* The find screen include the search form and include the screen list result wrap by FindScreenDecorator
* The screen result include the list result form wrap by EmbeddedDecorator
When you display a list with search criteria, pagination information and/or sort parameters, if you update an element of this list with a update area, you loose all of them.
Example:
<form name="ListProductMeters" type="list" list-name="productMeters" target="updateProductMeter" paginate-target="ListProductMeters">
<actions>
<entity-condition entity-name="ProductMeter">...
</actions>
<auto-fields-service service-name="updateProductMeter"/>
<field name="meterName"><text size="20"/></field>
<field name="updateButton"><submit/></field>
<on-event-update-area event-type="paginate"/>
<on-event-update-area event-type="sort-column"/>
<on-event-update-area event-type="submit"/>
</form>
Or this works well if you move an next page sort the list.
I realize the same principle for each event which do a modification of element in the list and after refresh it.
I also introduce the possibility to submit a form on modal (for edition) when you press 'enter' that will refresh the origin list.
Last point, the queryString element use to propage pagination state is also forwarded on callback element to keep this on update the list.
Thanks to Gil Portenseigne is help.
At this time the function ajaxSubmitFormUpdateAreas present on themes/common-theme/webapp/common/js/util/OfbizUtil.js take a form, submit it thought ajax and wait a success to analyse a json result for update an area with the cvsAreaString given on parameter.
I realized different improvements :
* refactoring some js code to centralize the analyze of json result for check if the call is a success or error
* Analyze the content-type of the response if is a json continue as before, else take the return and update first area (useful for submit search or filtering form)
* Manage the case who the ajax call failed and we inform the user
* Add a trigger to force the modal close on submit success
Thanks to Leila Mekika, Marie-Aline Pantais and Gil Portenseigne for looking on that.
(OFBIZ-12237)
Based on Rainbow Stone theme, The Helveticus theme is a modern relooking from Marine Desmarchelier.
Thanks to her for the proposal, Jacques Leroux, Leila Mekika and Gil Portenseigne for looking on that.
Remove quicksand binary files, and add import from fonts.googleapis.com
to solve licencing issue.
Remove licence notice from the LICENCE FILE.
Fix theme link into README.
Fix some comments in javascript.css files.
Thanks Jacques for your guidance !