Repository navigation
fix(viewer): escape run data in the trends charts - #742
Open
omkargaikwad23 wants to merge 1 commit into
Open
omkargaikwad23 wants to merge 1 commit into
omkargaikwad23 wants to merge 1 commit into
Conversation
The trends charts put run data into the page with no escape. Product and dataset names come from the config of each run. generate_d3_chart wrote the data as JSON into a script block, and json.dumps does not escape "</script>". The JSON now has "<", ">", and "&" as \uXXXX, which JavaScript reads as the same string. The tooltip in chart.js used .html() with the product name and the run ID. It now adds the labels and the values as text nodes.
omkargaikwad23
marked this pull request as ready for review
November 26, 2026 08:24
omkargaikwad23
requested review from
IsmailMehdi,
helloeve and
prernakakkar-google
as code owners
November 26, 2026 08:24
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.
Problem
The trends charts put run data into the page with no escape. Product and dataset names come from the config of each run.
generate_d3_chartwrote the data as JSON into a<script>block.json.dumpsdoes not escape</script>, so a name could end the block and start a new script.chart.jsused.html(...)with the product name and the run ID, so a name could add an HTML element.Change
generate_d3_chartescapes<,>, and&in the JSON as\uXXXX. JavaScript reads the same string. The chart config uses the same function.Tests
.ci/verify_viewer.pyhas a new check: a chart page with</script>in the run data must have 3 script blocks and no raw copy of that data.