You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Hesse (Jira)" <ji...@apache.org> on 2022/12/26 09:29:00 UTC

[jira] [Created] (WICKET-7022) JavaScriptStripper fails to detect regular expression correctly

Martin Hesse created WICKET-7022:
------------------------------------

             Summary: JavaScriptStripper fails to detect regular expression correctly
                 Key: WICKET-7022
                 URL: https://issues.apache.org/jira/browse/WICKET-7022
             Project: Wicket
          Issue Type: Bug
          Components: wicket-core
    Affects Versions: 9.11.0
            Reporter: Martin Hesse
         Attachments: summernote-bs5.js, summernote-bs5.min.js

The {{JavaScriptStripper}} fails to accurately detect regular expressions in some cases.

In the example below it fails to switch into the {{REG_EXP}} state at '{{{}return/[{}}}', and will then switch to {{LINE_COMMENT}} state when parsing '{{{}//{}}}', which will then lead to the entire rest of the JavaScript code to be cut off, making the code unparseable by the client.

{{return/[-a-zA-Z0-9@:%._\+~#=]\{2,256}\.[a-z]\{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(t)}};}}
An example of a webjar containing javascript, that will trigger the bug can be found here: [https://search.maven.org/artifact/org.webjars.npm/summernote/0.8.20/jar] - also see attached JS files below.


Current workaround is to disable compression:
getResourceSettings().setJavaScriptCompressor(null);



--
This message was sent by Atlassian Jira
(v8.20.10#820010)