Skip to content

Rs 22478 fix stored XSS in chart label rendering#80

Merged
chschan merged 3 commits into
masterfrom
RS-22478-fix-label-xss
Jun 12, 2026
Merged

Rs 22478 fix stored XSS in chart label rendering#80
chschan merged 3 commits into
masterfrom
RS-22478-fix-label-xss

Conversation

@chschan

@chschan chschan commented Jun 12, 2026

Copy link
Copy Markdown
Contributor
  • Pulls in fix from rhtmlParts for title, subtitle and footer
  • Applies similar fix to pie labels

chschan and others added 2 commits June 12, 2026 13:00
getLabelDimensionsUsingDivApproximation built the measurement div from a
jQuery HTML string ($('<div ...>' + inputString)), so untrusted segment
label text was parsed as HTML and executed (jQuery runs injected <script>
tags on insertion). Build the div with DOM APIs and set the label via
textContent instead; drop the now-unused jquery import. Rebuilt the
inst/htmlwidgets bundle and bumped the package version to 1.0.10.

Note: chart title/subtitle/footer labels are rendered via bundled
rhtmlParts and are NOT fixed here -- that needs rhtmlParts bumped to 3.0.1
(then reinstall + rebuild).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ter XSS)

Bump the bundled rhtmlParts dependency from 3.0.0 to 3.0.1, which routes
Title/Subtitle/Footer label text through textContent instead of innerHTML.
The rebuilt inst/htmlwidgets bundle now carries both the segment-label fix
and the rhtmlParts label fix; verified no innerHTML/jQuery-div label sinks
remain in the bundle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chschan chschan requested a review from JustinCCYap June 12, 2026 03:36
@@ -13,11 +12,15 @@ function _getUniqueId () {
}

function getLabelDimensionsUsingDivApproximation (inputString, fontSize = 12, fontFamily = 'sans-serif') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a duplicate of the function from rhtmlBuildUtils. Ideally we should have exported it from rhtmlBuildUtils and removed it here, rather than apply the same fix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This function is not exported from rhtmlParts. We looked in the other repos and only rhtmlPictograph and rhtmlPalmTree had a similar function but they are all slightly different so it seems better now to just keep these definitions separate.

@JustinCCYap JustinCCYap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@chschan chschan merged commit 3f3d3c2 into master Jun 12, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants