Conversation
Contributor
size-limit report 📦
|
showReportDialog assigned a plain string to script.src, which pages that enforce Trusted Types reject. Add a shared getTrustedScriptURL helper in browser-utils that mints URLs through a single "sentry-sdk" policy, and use it for the report dialog. One SDK-wide policy means users allowlist one name, and the other SDK script sinks (the replay compression worker, lazy-loaded integrations) can move onto it later. The policy only accepts the kinds of URL the SDK actually loads, currently the error-page embed endpoint. Without Trusted Types, or if the policy can't be created, the raw URL is used as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T35on2nNWQAfBWfSA9eBp1
oioki
force-pushed
the
feat/report-dialog-trusted-types
branch
from
September 25, 2026 12:34
fece237 to
ba2d12c
Compare
This branch has not been deployed
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.
Pages that enforce Trusted Types (
require-trusted-types-for 'script') reject plain strings in script-URL sinks, and the SDK has several that apps can't wrap because the URL is built internally. This adds a sharedgetTrustedScriptURLhelper in@sentry/browser-utilsthat mints URLs through a singlesentry-sdkpolicy, and uses it forshowReportDialogas the first caller.A single SDK-wide policy means users add one name to their
trusted-typesdirective, instead of one per feature. The other script-URL sinks can then move onto it: the replay compression worker (new Worker(blobURL)) andlazyLoadIntegration. The policy only accepts the kinds of URL the SDK actually loads, currently just the error-page embed endpoint, so it can't be used to load arbitrary scripts. Each new kind gets added together with the code that loads it.Without Trusted Types, or if the policy can't be created (for example the name isn't allowlisted), the raw URL is used exactly as before. The policy is per SDK copy rather than shared through the global carrier: sharing it across SDK versions would apply one version's URL rules to another's. Pages that load more than one SDK copy need
'allow-duplicates', which the debug warning mentions.Minimal local types are declared for
window.trustedTypes, since the DOM lib doesn't include Trusted Types and this avoids a new dependency.Found while rolling out Trusted Types in Sentry's own frontend.
https://claude.ai/code/session_01T35on2nNWQAfBWfSA9eBp1