Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-14944

[Backport] Ensure context-menu javascript render code does not allow user input other than numbers

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 13.4.15, 14.7.4, 15.0.0
    • None
    • None
    • 0.5
    • Nova
    • Team Nova Sprint 278

    Description

      The following three files contain a version of the snippet below that shows that user input is reflected in the response:

       community/cms/console/frontend/src/main/java/org/hippoecm/frontend/plugins/console/browser/BrowserPlugin.java

      community/cms/perspectives/src/main/java/org/hippoecm/frontend/plugins/cms/browse/tree/FolderTreePlugin.java

      community/cms/api/src/main/java/org/hippoecm/frontend/plugins/standards/tabs/TabbedPanel.java 

      final Request request = RequestCycle.get().getRequest();
      final IRequestParameters queryParameters = request.getQueryParameters();
      final StringValue x = queryParameters.getParameterValue(MOUSE_X_PARAM);
      final StringValue y = queryParameters.getParameterValue(MOUSE_Y_PARAM);
      final String renderContextMenu = String.format("Hippo.ContextMenu.renderAtPosition('%s', %s, %s);", menu.getMarkupId(), x, y);
      target.appendJavaScript(renderContextMenu);
      

      By ensuring the value is parsed as an Int (it is supposed to be a number anyway) we prevent a malicious user from trying an XSS attack.

      Attachments

        Activity

          People

            Unassigned Unassigned
            abogaart Arthur Bogaart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: