Skip to content

build custom metric dropdowns with DOM APIs#3867

Draft
1seal wants to merge 1 commit into
google:masterfrom
1seal:fix/custom-metrics-dom-construction
Draft

build custom metric dropdowns with DOM APIs#3867
1seal wants to merge 1 commit into
google:masterfrom
1seal:fix/custom-metrics-dom-construction

Conversation

@1seal
Copy link
Copy Markdown

@1seal 1seal commented Apr 22, 2026

summary

this replaces HTML string concatenation in startCustomMetrics() with jQuery DOM construction for custom metric dropdowns.

why

custom metric names were previously interpolated into markup before being passed to $(), which let the browser parse attacker-controlled content as HTML instead of treating it as data.

what changed

  • build the dropdown wrapper, button, caret, label container, and metric container with jQuery element constructors
  • keep the custom metric name in attribute values created through DOM APIs rather than through parsed HTML strings

validation

  • node --check cmd/internal/pages/assets/js/containers.js
  • local red/green verification with the attached reproduction artifacts:
    • make canonical
    • make fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant