Repository navigation
Description
Description
Trusted Types enable writing web applications that are free from DOM-Based Cross-Site-Scripting (XSS), the most prevalent web application vulnerability.
DOM-Based XSS occurs when attacker-controlled values reach certain Web API functions, like Element.innerHTML which causes the execution of the attacker's JavaScript code. This pattern is common, especially in larger applications, and detecting it requires complex interprocedural data flow tracking in a dynamic language ( a[b] = c might actually be a vulnerability). Before Trusted Types adoption at Google, DOM-Based XSS accounted for >%50 of XSS reported to Google VRP.
Trusted Types lock down those execution sinks to only accept values that were created securely; either because they are w3c/trusted-types#347 or because they were created through author-created w3c/trusted-types#347. One can also create a default, catch-all policy, e.g. to sanitize HTML or programmatically control where the scripts can be loaded from.
The lockdown is controlled via CSP, which enables breakage-free rollouts with report-only mode, and gradual, backwards-compatible code migration - using the new APIs without locking down the execution sinks. In fact, about 60% of pages rendered by Chrome globally already use Trusted Types, likely via inclusion of Alphabet's libraries, whereas around 14% of the traffic enforces Trusted Types via CSP.
Altogether, Trusted Types enable both writing new applications that are XSS-free, and eliminating DOM-Based XSS from existing applications, with a track record from Microsoft, Meta and Alphabet adoptions. As a data point, Alphabet applications migrated to Trusted Types have 0 reported XSS against them and we only see these bugs in applications not yet migrated, which is a significant reduction. In 2018 Google VRP rewarded $360K for all XSSes, in 2022 it was $95K.
Since 2023, Trusted Types is being upstreamed into HTML.
Interop 2025 and 2024 proposals: #800, #500
cc: @otherdaniel
Specification
https://w3c.github.io/trusted-types/dist/spec/
web-feature
https://web-platform-dx.github.io/web-features-explorer/features/trusted-types/
Test Links
https://wpt.fyi/results/trusted-types
Additional Signals
Standards Positions:
- Mozilla: (Positive) Trusted Types mozilla/standards-positions#20
- WebKit: (Positive) Trusted Types WebKit/standards-positions#186
Browser Bugs:
Additional Signals:
- Trusted Types rollouts - w3c Trusted Types - mid 2021 report Trusted Types Interop 2024 proposal
- Meta uses Trusted Types by default for new products, and rolls out TT enforcement in existing products (in 2022 they reported 50% already migrated). MS uses Trusted Types for Edge integration applications (Bing Collections), and in Edge WebUI pages.
- Integration of Trusted Types completed or ongoing for several libraries and frameworks (https://github.com/w3c/trusted-types/wiki/Integrations)
- TT are supported in Next.js TT are a top priority for the Angular framework, as it would allow them to move away from user space-level safe-value constructs.
- Usage
- https://chromestatus.com/metrics/feature/timeline/popularity/3279 (60% of page loads create a Trusted Types Policy in main document, or a subframe)
- https://chromestatus.com/metrics/feature/timeline/popularity/2724 (0.78% use a default Trusted Type policy)
- https://chromestatus.com/metrics/feature/timeline/popularity/3160 (13.4% enforce Trusted Types via CSP)
- https://chromestatus.com/metrics/feature/timeline/popularity/3161 (0.46% use a report-only Trusted Types CSP)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Sep 22, 2025
This comment was automatically generated based on the information you provided. Please don't edit it.
Below is additional information about the web feature (from the web-features project) which is referenced in your proposal.
If this doesn't accurately correspond to your proposal, please update your initial comment to include
web-features: <feature-id>.To find feature IDs, use the web-features explorer.
Feature Trusted types
o-t-w commentedon Oct 1, 2025
Starting with Firefox 145, the Trusted Types API is now enabled in Firefox Nightly.
wpt-interop commentedon Feb 12, 2026
Thank you for proposing Trusted Types for Interop 2026.
We want to let you know it was not selected to be part of Interop this year.
On behalf of the entire Interop team, thank you for submitting it for consideration. We got many more proposals than we could include in this year's project, necessitating some difficult choices. Please note this should not be taken as a comment on the technology as a whole, or our willingness to consider it for Interop in the future. We appreciate the work you put into your proposal, and would welcome your participation in future rounds of Interop.
Posted on behalf of the Interop team.