Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PPP-5353]-XSS Findings For Pentaho-platform-plugin-reporting #864

Closed

Conversation

Rangashivani
Copy link

@Rangashivani Rangashivani commented Nov 6, 2024

PPP-5353-XSS Findings For Pentaho-platform-plugin-reporting

@Rangashivani Rangashivani requested a review from a team as a code owner November 6, 2024 10:27
@buildguy

This comment has been minimized.

@Rangashivani Rangashivani requested a review from dcleao November 6, 2024 13:12
@@ -15,26 +15,26 @@
*
*/
define(["dojo/_base/declare", "dijit/_WidgetBase", "dijit/_Templated", "dojo/on", "dojo/query",
"pentaho/common/button", "pentaho/common/Dialog", "dojo/text!pentaho/reportviewer/GlassPane.html"],
function(declare, _WidgetBase, _Templated, on, query, button, Dialog, templateStr){
"pentaho/common/button", "pentaho/common/Dialog", "dojo/text!pentaho/reportviewer/GlassPane.html","common-ui/util/xss"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after comma.

@@ -72,7 +73,7 @@ define(function() {
if(!enabled) { return null; }

// May be null in case popups blocked
var logWin = window.open('', options.winname || 'report_viewer_log');
var logWin = xssUtil.setHtml(window.open('', options.winname || 'report_viewer_log'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is setHtml used in this case?

@@ -822,7 +822,7 @@ define([ 'common-ui/util/util', 'common-ui/util/timeutil', 'common-ui/util/forma
if(isRunningIFrameInSameOrigin) {
if (!top.mantle_initialized) {
this._topMantleOpenTabRegistration = top.mantle_openTab = function(name, title, url) {
window.open(url, '_blank');
window.open(xssUtil.sanitizeHtml(url), '_blank');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is setHtml used in this case? Not sure it applies for an empty URL. Please coordinate with @mmujahiduddin regarding sanitizeUrl: pentaho/pentaho-platform#5758 (comment).

*/

define([ 'common-ui/util/util', 'common-ui/util/timeutil', 'common-ui/util/formatting', 'pentaho/common/Messages',
"dojo/dom", "dojo/on", "dojo/_base/lang", "dijit/registry", "dojo/has", "dojo/sniff", "dojo/dom-class",
'pentaho/reportviewer/ReportDialog', "dojo/dom-style",
"dojo/query", "common-ui/util/_a11y", "dojo/dom-geometry", "dojo/parser", "dojo/window", "dojo/_base/window",
'cdf/lib/jquery', 'amd!cdf/lib/jquery.ui', "common-repo/pentaho-ajax", "dijit/ProgressBar", "common-data/xhr"],
'cdf/lib/jquery', 'amd!cdf/lib/jquery.ui', "common-repo/pentaho-ajax", "dijit/ProgressBar", "common-data/xhr","common-ui/util/xss"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after comma.

@@ -1193,7 +1193,7 @@ define([ 'common-ui/util/util', 'common-ui/util/timeutil', 'common-ui/util/forma
hideDlgAndPane(registry.byId('feedbackScreen'));

//Show loading screen
$('#notification-message').html(_Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
xssUtil.setHtml($('notification-message'), _Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find the comment from another PR review where I wrote this, so I'm repeating here.

Note that the query selector passed to jQuery should remain as #notification-message.

The XSS Utility setHtml(elem, html) method does not support jQuery objects in the first argument, only actual HTMLElement.

On the other hand, if we keep using the pattern $('#notification-message').html(xssUtil.sanitizeHtml(html)) with jQuery instances, likely, the corresponding AppScan findings will not be automatically resolved.

As such, we should consider adding support for jQuery objects to the existing setHtml(..) method, and then use it with these jQuery cases.

@@ -1236,7 +1236,7 @@ define([ 'common-ui/util/util', 'common-ui/util/timeutil', 'common-ui/util/forma
isPageCountUpdated = true;
}

$('#notification-message').html(_Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
xssUtil.setHtml($('#notification-message'), _Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem, regarding adding jQuery support to setHtml(..).

@@ -1246,13 +1246,13 @@ define([ 'common-ui/util/util', 'common-ui/util/timeutil', 'common-ui/util/forma
case "QUEUED":
case "WORKING":
// Although we are hiding the screen latter, update the label anyway;
$('#notification-message').html(_Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
xssUtil.setHtml($('#notification-message'), _Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem, regarding adding jQuery support to setHtml(..).

me._hideAsyncScreens();
me._keepPolling(mainJobStatus.uuid, url, mainReportGeneration);
break;
case "FINISHED":
// Although we are hiding the screen latter, update the label anyway;
$('#notification-message').html(_Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
xssUtil.setHtml($('#notification-message'), _Messages.getString('LoadingPage') + " " + mainJobStatus.page + " " + _Messages.getString('Of') + " " + mainJobStatus.totalPages);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem, regarding adding jQuery support to setHtml(..).

@buildguy
Copy link
Collaborator

buildguy commented Nov 7, 2024

👍 Frogbot scanned this pull request and did not find any new security issues.

Note:

Frogbot also supports Contextual Analysis, Secret Detection, IaC and SAST Vulnerabilities Scanning. This features are included as part of the JFrog Advanced Security package, which isn't enabled on your system.


@buildguy
Copy link
Collaborator

buildguy commented Nov 7, 2024

✅ Build finished in 5m 58s

Build command:

mvn clean verify -B -e -Daudit -Djs.no.sandbox -pl core

👌 All tests passed!

Tests run: 540, Failures: 0, Skipped: 3    Test Results


ℹ️ This is an automatic message

@Rangashivani Rangashivani closed this by deleting the head repository Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants