Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-7022

JavaScriptStripper fails to detect regular expression correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 9.12.0
    • 10.0.0-M1, 9.13.0
    • wicket-core
    • None

    Description

      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);

      Attachments

        1. summernote-bs5.js
          317 kB
          Martin Hesse
        2. summernote-bs5.min.js
          149 kB
          Martin Hesse

        Activity

          People

            bitstorm Andrea Del Bene
            mwhesse Martin Hesse
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: