You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: escape YAML data in threat model detail overlay to prevent XSS (#140)
* fix: escape YAML data in threat model detail overlay to prevent XSS
The showThreatDetail() function in all four threat model pages (en, ja,
ko, zh-cn) concatenates YAML-sourced threat data directly into innerHTML
without sanitization. Because the trust page invites community
contributions to the threat model via pull requests, a malicious PR
modifying threats.yaml could inject arbitrary HTML/JS that executes when
a visitor clicks any threat card.
Add an escapeHtml() helper that encodes &, <, >, ", and ' and wrap all
data fields (risk, atlas, description, attackVector, affected,
mitigations, residualRisk, recommendations) and i18n label values before
innerHTML insertion.
Existing textContent assignments (detailId, detailTitle) are already
safe and left unchanged.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
* fix: use DOM API for badges to prevent href attribute XSS
Replace innerHTML badge construction with createElement/setAttribute
to address VADE security review feedback. escapeHtml() is insufficient
for href attributes because the browser decodes HTML entities during
innerHTML parsing, allowing attribute boundary breakout. Using
setAttribute bypasses HTML parsing entirely.
All four locale files updated (en, ja, ko, zh-cn).
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
* fix: harden threat model overlay rendering
---------
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
0 commit comments