Details
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.