Repository navigation
feat(web): let apps supply a Trusted Types policy for templates - #4833
Conversation
🦋 Changeset detectedLatest commit: b937893 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will degrade performance by 11.93%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
…late sinks through the policy On the server, setTrustedTypesPolicy is a no-op instead of notSup, so an isomorphic entry that sets a policy does not throw. The server entry also exports trustedHTML (returns the string) to match the client. @solidjs/html decodes text and attribute references by assigning to innerHTML; those three assignments now go through trustedHTML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWNXgCqM6277GHNWmJX
Solid fails on pages that enforce
require-trusted-types-for 'script', becausetemplate()and the frames client assign plain strings toinnerHTML. This addssetTrustedTypesPolicy(policy). The app passes a policy it created, and the runtime assigns theTrustedHTMLthat policy returns, both for compiled template markup and for the server HTML the frames client parses.Apps that do not call it are unchanged, and a page without server components measures 0 B over
next. The frames wiring adds 62 to 76 B minified, so two caps are re-recorded here (frames eager 11.77 KB to 11.80 KB, compiled live 44.95 KB to 44.98 KB). The 1.x counterpart is ryansolid/dom-expressions#601.