Commit Graph
107 Commits
Author SHA1 Message Date
Jacques Le Roux c3a6636e40 Improved: Use gradlew npm_outdated gradle-node-plugin taks to check outdated scripts (OFBIZ-12480)
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
2022-01-08 13:04:10 +01:00
Jacques Le Roux 83d0880ab8 Improved: Use NPM with gradle to get external JS dependencies (OFBIZ-11960)
Updates flot from 0.8.2 to 4.2.2 using npm
2022-01-08 11:18:40 +01:00
bjugl 4ae01b94f1 Improved: Replace ELRTE plugin with Trumbowyg (OFBIZ-10093) (#425)
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
2022-01-07 12:16:27 +05:30
Jacques Le Roux 504c3fcf1c Improved: no longer needed, IE8 is totally deprecated 2021-12-10 11:42:10 +01:00
Jacques Le Roux 49362441b7 Improved: Use NPM with gradle to get external JS dependencies (OFBIZ-11960)
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
2021-11-11 16:05:35 +01:00
Jacques Le Roux a201894d5c Improved: Fix OFBiz specific Javascript security issues reported by GH CodeQL (OFBIZ-12366)
Oops, fixes a syntax issue
2021-11-11 09:03:32 +01:00
Jacques Le Roux b38fd52e1f Improved: Fix OFBiz specific Javascript security issues reported by GH CodeQL (OFBIZ-12366)
Reassures CodeQL that all is correct, even if it was already OK
2021-11-11 07:46:20 +01:00
Jacques Le Roux 554dace63d Improved: Fix OFBiz speficic Javascript securiy issues reported by GH CodeQL (OFBIZ-12366)
Non functional change to test codeQL setting
2021-11-10 20:53:00 +01:00
Jacques Le Roux 9e89930e00 Fixed: Fix OFBiz speficic Javascript securiy issues reported by GH CodeQL (OFBIZ-12366)
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
2021-11-10 16:08:02 +01:00
Jacques Le Roux dfc7ee4032 Improved: Fix OFBiz speficic Javascript securiy issues reported by GH CodeQL (OFBIZ-12366)
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.
2021-11-08 13:14:24 +01:00
Jacques Le Roux ce564ebc2a Improved: Try to reduce "Incomplete string escaping or encoding branch" issues reported by CodeQL (OFBIZ-12356)
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.
2021-10-31 15:29:30 +01:00
Jacques Le Roux bea540254f Improved: Update jquery-validation to 1.19.3 for security reason (OFBIZ-12339)
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.
2021-10-18 13:18:54 +02:00
Jacques Le Roux d1da059464 Fixed: Update jquery-validation to 1.19.3 for security reason (OFBIZ-12339)
Dependabot installed at GH warned me about this vulnerability during pushing
2021-10-16 18:53:25 +02:00
Aditya Sharma 4bd30ce4d5 Implemented: Use NPM with gradle to get external JS dependencies (OFBIZ-11960)
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.
2021-10-12 20:50:41 +01:00
Gil Portenseigne ab9ca12221 Execute a callback with parameters from the request (OFBIZ-12262)
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.
2021-09-07 14:56:20 +02:00
Gil Portenseigne a37d5cc5d5 Fixed: Jgrowl label are not well retrieved showing 'undefined' button (OFBIZ-12299)
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.
2021-08-18 09:29:10 +02:00
Jacques Le Roux 13d6bc2913 Improved: Fix issues reported by SonarQube analysis on Github (OFBIZ-12284)
Those should be OK, for instance I see no reasons to do something like that:
window.location.href = window.location.href;
2021-08-06 11:45:30 +02:00
Nicolas Malin 7792565fcf Fixed: Improve js function OfbizUtil.ajaxSubmitFormUpdateAreas, some errors don't appear (OFBIZ-12268)
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
2021-07-12 17:20:44 +02:00
Nicolas Malin 2a509be3a9 Improved: Improve js function OfbizUtil.ajaxSubmitFormUpdateAreas (OFBIZ-12268)
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.
2021-07-02 17:17:07 +02:00
Nicolas Malin 99696b0228 Fixed: Xml Element Link type hidden-form fail to resolve the form
(OFBIZ-12260)

When you generate a link with the type hidden-form and the link present an update area, on the click jquery failed to resolve the form.

 Example of a current link generate :

  <a href="javascript:ajaxSubmitFormUpdateAreas('ListProductMeterActionMenus_delete_LF_1__0', 'embedded13009956-a841-47d3-86b1-b1931e6b430e,https://localhost:8443/catalog/control/ListProductMeters,productId=GZ-1000')">javascript:ajaxSubmitFormUpdateAreas('ListProductMeterActionMenus_delete_LF_1__0', 'embedded13009956-a841-47d3-86b1-b1931e6b430e,https://localhost:8443/catalog/control/ListProductMeters,productId=GZ-1000')</a>

The problem come from OfbizUtil.js:748

    var $form = jQuery("#" + form)

To solve it, we change the form resolution in the function ajaxSubmitFormUpdateAreas with use the form name instead the form id.

Thanks to Xin Wang for this suggest to fix it.
2021-06-22 09:38:03 +02:00
Aditya Sharma e97f45c381 Fixed: removed unused asmselect files and unused variable asm_asmListItemPercentOfForm (OFBIZ-10113)
asm select library is already replaced with select2 library, but the library files still exist in code base unused.
asm_asmListItemPercentOfForm varaible was used to set the width of the selected items which were displaced distictly from select fields. With select2, the selected items display inside the input field so it is no more needed

Thanks Jacques Le Roux for reporting it
2021-05-12 11:57:54 +05:30
wpaetzold d6eaef2f9b Fixed: Page selection is not working correctly in the lookup-dialog (#287)
(OFBIZ-12163)
2021-03-15 13:38:28 +01:00
James Yong 0863084062 Improved: Apply CSS Grid to Find Orders (OFBIZ-12116)
Improve CSS for centering grid item
2021-01-26 20:56:23 +08:00
James Yong d32814e5c8 Fixed: Incorrect date format in tooltip (OFBIZ-12123)
Tooltip should show the date format used by the picker.
2021-01-12 12:32:53 +08:00
James Yong 25adbd2088 Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097)
Fixed regression. Manual entry is cleared after moving to next field.

Thanks: Olivier for reporting
2021-01-12 11:11:01 +08:00
James Yong ba5536fe57 Improved: Apply CSS Grid to Find Orders (OFBIZ-12116)
Improve naming
2021-01-03 11:13:13 +08:00
James Yong 6f3c7cb4c2 Improved: Apply CSS Grid to Find Orders (OFBIZ-12116)
Apply CSS Grid Layout on the form.
Keep related fields together
2021-01-02 12:46:44 +08:00
James Yong cc90994a4f Add notes to js funcs 2020-12-20 15:01:09 +08:00
James Yong 483e77ea83 Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097)
Use inline script when request is ajax
2020-12-20 08:46:52 +08:00
James Yong 71a0d6b4db Improved: Change inline style to class for wait-spinner (OFBIZ-12095)
Add code missed in earlier commit
2020-12-19 13:10:47 +08:00
James Yong d3801256df Improved: Change inline style to class for wait-spinner (OFBIZ-12095)
Inline style not encouraged by Content Security Policy
2020-12-19 12:42:28 +08:00
James Yong 798822c94f Fixed: wait spinner doesn't show when running ajaxUpdateArea (OFBIZ-12094)
Use setTimeout() after running waitSpinnerShow() to ensure wait spinner icon is displayed properly.
2020-12-19 09:19:34 +08:00
James Yong e405d35c08 Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load locale-specific datepicker js.
Corrected locale naming in macro to use '.locale'.
Tested page at /ordermgr/control/findreturn and /ordermgr/control/orderentry.
2020-12-05 23:23:04 +08:00
James Yong a3fbb66479 Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load time-related js and css for date time picker.
Tested page at /ordermgr/control/findreturn and /ordermgr/control/orderentry
2020-11-30 10:29:08 +08:00
James Yong bc5b0d595c Improved: Load language js for date.js only when required (OFBIZ-12064)
Tested on
1) date time field at /ordermgr/control/orderentry and
2) date find field at /ordermgr/control/findreturn
2020-11-27 21:51:35 +08:00
James Yong 0987c11ca7 Improved: Remove date.format-1.2.3-min.js (OFBIZ-12040)
This Javascript library is not use in the project.
2020-10-10 19:36:24 +08:00
Jacques Le Roux 51dbd9399f Fixed: Open FTL File from browser (OFBIZ-12018)
Adds missing ASL2 header
2020-10-08 12:51:15 +02:00
James Yong 6fa16710bc Fixed: Open FTL File from browser (OFBIZ-12018)
Fix named border not properly clean up.
2020-10-03 17:51:15 +08:00
James Yong 10fbedbce0 Fixed: Open FTL File from browser (OFBIZ-12018)
Not able to open source file when clicking on named border in ecomseo landing page

Thanks Jacques for reporting
2020-10-02 20:33:44 +08:00
James Yong f15c037e07 Fixed: Open FTL File from browser (OFBIZ-12018)
Some named borders were hidden in ecomseo landing page
2020-09-30 19:16:53 +08:00
James Yong c911019856 Improved: Open FTL File from browser (OFBIZ-12018)
Better usability when clicking on named border
2020-09-28 21:50:01 +08:00
James Yong ad2e8de7c2 Improved: Open FTL File from browser (OFBIZ-12018)
Add function to open the corresponding FTL file with IDE
when the named border is clicked from browser.

Thanks Rishi and Jacques for review
2020-09-24 21:36:24 +08:00
James Yong 814d95afc8 Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002)
Fixed some other named borders not removed +
Only increase z-index for the border labels
2020-09-21 14:45:00 +08:00
James Yong 26fcfd180b Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002)
Unable to add internal organization in HR tree

Thanks Olivier for reporting
2020-09-21 14:23:36 +08:00
James Yong b18dd6a9ce Improved: Show border and file name for content rendered from ftl (OFBIZ-12002)
To reduce the need to view the page source from the browser.
Activated when print.verbose=true and widget.verbose=true.

Thanks: Jacques for review
2020-09-12 20:10:08 +08:00
James Yong 840315781a Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load jeditable js
Tested page at example/control/authview/findExampleAjax
2020-09-01 22:10:37 +08:00
James Yong fc44f9ce3b Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load fjTimer/jquerytimer-min.js
Tested on /partymgr/control/viewprofile?partyId=DemoEmployee
2020-08-30 21:25:10 +08:00
James Yong 149e90e608 Improved: Move page-specific script links to html template (OFBIZ-11799)
use importLibrary js function to load moment js.
2020-08-19 10:17:51 +08:00
James Yong 90e43c9713 Improved: Replace Mask Js (OFBIZ-11964)
Replace library from
https://github.com/igorescobar/jQuery-Mask-Plugin
to
https://github.com/RobinHerbots/Inputmask

Tested at
https://localhost:8443/example/control/FormWidgetExamples
2020-08-19 08:37:39 +08:00
James Yong 7322abbcbe Improved: Move page-specific script links to html template (OFBIZ-11799)
refactoring
2020-08-17 20:45:47 +08:00