Title: Support Trusted Types (require-trusted-types-for 'script') · Issue #24744 · getsentry/sentry-javascript · GitHub
Open Graph Title: Support Trusted Types (require-trusted-types-for 'script') · Issue #24744 · getsentry/sentry-javascript
X Title: Support Trusted Types (require-trusted-types-for 'script') · Issue #24744 · getsentry/sentry-javascript
Description: Problem Statement Apps that enforce Trusted Types (Content-Security-Policy: require-trusted-types-for 'script') can't use several SDK features without a pass-through default policy, which disables Trusted Types for the whole page. Repro:...
Open Graph Description: Problem Statement Apps that enforce Trusted Types (Content-Security-Policy: require-trusted-types-for 'script') can't use several SDK features without a pass-through default policy, which disables ...
X Description: Problem Statement Apps that enforce Trusted Types (Content-Security-Policy: require-trusted-types-for 'script') can't use several SDK features without a pass-through default policy, whi...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/24744
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support Trusted Types (require-trusted-types-for 'script')","articleBody":"### Problem Statement\n\nApps that enforce Trusted Types (`Content-Security-Policy: require-trusted-types-for 'script'`) can't use several SDK features without a pass-through `default` policy, which disables Trusted Types for the whole page.\n\nRepro: https://github.com/oioki/trusted-types-sentry-js-sdk. It's a minimal Vite + React app with `@sentry/react` 11.0.0 and no Trusted Types policies of its own, so every violation comes from the SDK.\n\n| Sink | Where | Enforced result | Workaround |\n| --- | --- | --- | --- |\n| `new Worker(url)` | Replay compression worker | Caught; replay continues | `useCompression: false` (larger payloads) |\n| `innerHTML` | Feedback form (`dangerouslySetInnerHTML`: logo, success icon, screenshot styles) | Form doesn't render | `showBranding: false` covers the logo only |\n| `script.src` | `showReportDialog()` | Throws, no dialog | None |\n| `innerHTML` | `error-page-embed.js` (served by Sentry) | Blocked once the dialog loads | None |\n| `script.src` | `lazyLoadIntegration()` | Throws | None |\n| `script.src` | Loader Script | Throws | None |\n\nThe workaround in #15913 (`workerUrl`) doesn't help: `new Worker(url)` requires a `TrustedScriptURL` for any string URL, not just `blob:` URLs, so a self-hosted worker still violates.\n\nTeams with a strict CSP (enterprise, fintech, public sector, Angular and Lit users) currently have to choose between Sentry's Replay, Feedback and User Feedback dialog and enforcing Trusted Types. Teams in report-only rollout also get SDK noise in their violation reports, with no policy name they can allow.\n\n### Solution Brainstorm\n\n- The SDK creates one named policy, e.g. `sentry-sdk`, that validates rather than passes values through. It would allow only script URLs the SDK builds itself (DSN host plus the known paths, the CDN) and only static HTML. Apps allow it with `trusted-types sentry-sdk`.\n- Remove the `innerHTML` uses in feedback by building the SVG and styles with DOM APIs.\n- Document the CSP needed (`trusted-types sentry-sdk`, and `'allow-duplicates'` when more than one SDK copy is on the page).\n\n### Additional Context\n\n#24738 is a first step: a shared `sentry-sdk` policy helper, used by `showReportDialog`.\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>\n","author":{"url":"https://github.com/oioki","@type":"Person","name":"oioki"},"datePublished":"2026-09-25T13:21:23Z","url":"https://github.com/getsentry/sentry-javascript/issues/24744"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:65880e37-17af-ffcf-a839-42a3822eb46a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F20:1C619:2346B5:3251B7:6B04698D |
| html-safe-nonce | c4eb9c7705fb2584f8d3fd70a6e79b042392f3bb3bcdd9fb3fe35f019fb43c21 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjIwOjFDNjE5OjIzNDZCNTozMjUxQjc6NkIwNDY5OEQiLCJ2aXNpdG9yX2lkIjoiOTI0Njg0MDU4MDc0ODM1MzQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | eb6177b320f4402844d97346d8aa48238ee3ed48ab1d188108605aec69983607 |
| hovercard-subject-tag | issue:5583386758 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/24744/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e6ddd3073a12c5db452f244f4deaf0f7950396603f431829c52986273a6a0cfa/getsentry/sentry-javascript/issues/24744 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e6ddd3073a12c5db452f244f4deaf0f7950396603f431829c52986273a6a0cfa/getsentry/sentry-javascript/issues/24744 |
| og:image:alt | Problem Statement Apps that enforce Trusted Types (Content-Security-Policy: require-trusted-types-for 'script') can't use several SDK features without a pass-through default policy, which disables ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | oioki |
| hostname | github.com |
| expected-hostname | github.com |
| None | 83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ca4d07a7cef4e4b75f821dc25e7300d80c1450a9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width