codeant-ai-for-open-source[bot] commented on code in PR #43397:
URL: https://github.com/apache/superset/pull/43397#discussion_r3831864869
##########
superset-frontend/plugins/plugin-chart-echarts/src/Radar/utils.ts:
##########
@@ -85,19 +86,29 @@ export const renderNormalizedTooltip = (
};
});
+ // SECURITY: the tooltip is rendered via innerHTML (ECharts default
+ // renderMode 'html'). `seriesName` is built from raw group-by values in
+ // the query results and `metric` from creator-controlled metric labels,
+ // so both must be HTML-escaped — matching the sanitizeHtml/tooltipHtml
+ // treatment every other echarts tooltip path applies. Values are escaped
+ // too for consistency (formatter output is plain text).
const tooltipRows = metricValues
.map(
({ metric, value }) => `
<div style="display:flex;">
- <div>${colorDot}${metric}:</div>
- <div style="font-weight:bold;margin-left:auto;">${value}</div>
+ <div>${colorDot}${sanitizeHtml(metric)}:</div>
Review Comment:
**Suggestion:** The newly added tooltip row still inserts `colorDot`, whose
`background-color` style contains the unsanitized `color` value from ECharts
callback parameters. Because this string is rendered through the tooltip's
`innerHTML` path, a color containing quotes or markup can break out of the
style attribute and inject HTML. Escape or validate `color` before constructing
the style attribute. [security]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Radar tooltip HTML can be altered through an unvalidated custom label
color.
- ⚠️ Dashboard viewers can receive script-capable markup on hover.
- ⚠️ Existing metric and series escaping does not cover `colorDot`.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/plugins/plugin-chart-echarts/src/Radar/utils.ts
**Line:** 99:99
**Comment:**
*Security: The newly added tooltip row still inserts `colorDot`, whose
`background-color` style contains the unsanitized `color` value from ECharts
callback parameters. Because this string is rendered through the tooltip's
`innerHTML` path, a color containing quotes or markup can break out of the
style attribute and inject HTML. Escape or validate `color` before constructing
the style attribute.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43397&comment_hash=ac9f919015b5e21c4ce49d4499e697f3aaf952a4f420fd8ea18c92a6c81db8ad&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43397&comment_hash=ac9f919015b5e21c4ce49d4499e697f3aaf952a4f420fd8ea18c92a6c81db8ad&reaction=dislike'>👎</a>
--
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]