Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand trusted types guidance #37917

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

wbamberg
Copy link
Collaborator

@wbamberg wbamberg commented Feb 2, 2025

I had thought to defer updates to the trusted types docs until it ships cross-browser, but given conversations like w3c-cg/swag#9 (comment) and our general desire to talk about this API, I thought it was worth expanding on things a little now.

We should think of this PR as a stop-gap though: I still think we should revisit these docs, write a proper guide, and refresh all the API pages, when the API ships in Firefox or Safari.

This PR expands the Trusted Types API overview page in two ways:

  • explain better about enforcement using a CSP
  • explain about polyfills, since people can get the benefit of this API cross-browser now

I also updated the rest of the section to be clearer about what the API actually does and how it connects with XSS - I thought things like "lock down the insecure parts of the DOM API" weren't very meaningful.

I hope I understood the bit about polyfills!

@aaronshim, @lukewarlow

@github-actions github-actions bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Feb 2, 2025
Copy link
Contributor

github-actions bot commented Feb 2, 2025

Preview URLs (6 pages)
External URLs (3)

URL: /en-US/docs/Web/API/Trusted_Types_API
Title: Trusted Types API

(comment last updated: 2025-02-02 17:07:17)

@wbamberg wbamberg marked this pull request as ready for review February 2, 2025 17:36
@wbamberg wbamberg requested a review from a team as a code owner February 2, 2025 17:36
@wbamberg wbamberg requested review from sideshowbarker and hamishwillee and removed request for a team and sideshowbarker February 2, 2025 17:36
@lukewarlow
Copy link
Contributor

I will try to review this change during this week.

The polyfill specifically might need some updates to match it with latest spec changes I'm not sure of its current state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants