Repository navigation
Require Trusted Types in every app's CSP - #74
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
siame
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every four-stroke document's Content-Security-Policy now requires Trusted Types:
The nonce and
'strict-dynamic'already decide which scripts run. Trusted Types close the other way in: every DOM sink that can run code (innerHTML, a script'ssrc, a worker's address) refuses a plain string and takes only what a named policy made. The requirement holds in dev as well, so a hand check undermake devexercises it.{ "trusted-types": ["dompurify"] }. Sources are appended as before, so an app can add a policy name but cannot lift the requirement.four-strokepolicy.ServiceWorkerContainer.registeris a TrustedScriptURL sink, sowhenControllednow builds the address through a policy that makes/auth-service-worker.jsand throws on anything else. It is created once per page (a policy name can be created only once), and a browser without Trusted Types gets the plain string.globalThis.trustedTypestakes one commented type assertion rather than a new@types/trusted-typesdependency.Follow-ups once this is released (not in this PR):
dompurifyin its sources.ServiceWorkerBridge, whose bare-stringregister()the policy would refuse;controlledFetchalready registers the same worker.Releasing this before referral-engine's change lands would break job descriptions that carry HTML, so the bumps and that change go together.
🤖 Generated with Claude Code