Visitar URL original
USWDS - Footer: Prevent unsafe element creation from data-tag attribute by IHIutch · Pull Request #6674 · uswds/uswds · GitHub
Skip to content

USWDS - Footer: Prevent unsafe element creation from data-tag attribute - #6674

Merged
ethangardner merged 4 commits into
uswds:developfrom
IHIutch:fix-footer-dom-text-reinterpretation
Jun 19, 2026
Merged

ethangardner merged 4 commits into
uswds:developfrom
IHIutch:fix-footer-dom-text-reinterpretation

Conversation

@IHIutch

@IHIutch IHIutch commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Creates a fixed list of acceptable elements that are not passed manually from the DOM, via data-tag. Prevents attackers from exploiting unsanitized HTML reassignment. Related CodeQL finding.

Breaking change

⚠️ This is potentially a breaking change.

This change narrows the allowable elements of data-tag from any DOM element to only heading elements. This follows the intent of the footer component, but in certain circumstances, would affect projects where data-tag was manually set to something other than a heading element. This change gracefully sets "unacceptable" elements back to h4, which was the behavior prior to #5044, while still preserving any heading elements (i.e. h1 stays h1).

Related issue

Closes #6521

Testing and review

Adds a new test to ensure any non-heading element passed to data-tag gracefully falls back to h4 .


  • Confirm that this code follows the 18F Front End Coding Style Guide and Accessibility Guide.
  • Run git pull origin [base branch] to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch is develop).
  • Run npm run prettier:sass to format any Sass updates.
  • Run npm test and confirm that all tests pass.
  • Run your code through HTML_CodeSniffer and make sure it’s error free.

@ethangardner ethangardner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Thanks for this improvement and contribution!

@ethangardner
ethangardner merged commit 12b176d into uswds:develop Jun 19, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Triage to Fed Final Review in USWDS Core Project Data Jun 19, 2026
@chandracarney chandracarney moved this from Fed Final Review to Done in USWDS Core Project Data Jul 20, 2026
@ethangardner ethangardner added this to the uswds 3.14.0 - Aug 2026 milestone Aug 4, 2026
@annepetersen annepetersen added the ❤️ Thanks Historical appreciation marker. Prefer a reaction; not required for triage. label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

❤️ Thanks Historical appreciation marker. Prefer a reaction; not required for triage.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

DOM text reinterpreted as HTML

4 participants