Rs 22478 fix stored XSS in chart label rendering#80
Merged
Conversation
chschan
commented
Jun 12, 2026
Contributor
- Pulls in fix from rhtmlParts for title, subtitle and footer
- Applies similar fix to pie labels
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>
JustinCCYap
reviewed
Jun 12, 2026
| @@ -13,11 +12,15 @@ function _getUniqueId () { | |||
| } | |||
|
|
|||
| function getLabelDimensionsUsingDivApproximation (inputString, fontSize = 12, fontFamily = 'sans-serif') { | |||
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.