rusackas opened a new pull request, #40612: URL: https://github.com/apache/superset/pull/40612
### SUMMARY In `superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.ts`, the tooltip helper `generateMultiLineTooltipContent` builds an HTML string by interpolating `series.key` (which is derived from groupby column values, i.e. data-controlled) and returned it **without** passing it through `dompurify.sanitize`. It also called `getFormattedKey(series.key, false)`, explicitly skipping sanitization of the key. Its two sibling helpers in the same file — `generateCompareTooltipContent` and `generateTimePivotTooltip` — both sanitize their output via `dompurify.sanitize(...)` and pass `shouldDompurify=true`. This helper was the odd one out, so any future wiring of its output into an `innerHTML`-based sink (which is how nvd3 `contentGenerator` output is rendered) would expose the inconsistency. This change aligns the helper with the others: - `getFormattedKey(series.key, true)` so the key is sanitized like in the compare tooltip. - `return dompurify.sanitize(tooltip)` instead of returning the raw string. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — output is sanitized HTML; no visual change for legitimate data. ### TESTING INSTRUCTIONS ``` cd superset-frontend npm run test -- plugins/legacy-preset-chart-nvd3/test/utils.test.ts ``` Added tests under `generateMultiLineTooltipContent()`: - renders a normal series key unchanged, - strips an `onerror` event-handler payload injected via `series.key`, - removes `<script>` tags injected via `series.key`. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
