Skip to content

fix(feedback): Render feedback widget without innerHTML for Trusted Types - #26707

Open
msonnb wants to merge 1 commit into
developfrom
ms/feedback-trusted-types
Open

msonnb wants to merge 1 commit into
developfrom
ms/feedback-trusted-types

Conversation

@msonnb

@msonnb msonnb commented Nov 20, 2026

Copy link
Copy Markdown
Member

What

The feedback widget now renders on pages that enforce Trusted Types (require-trusted-types-for 'script'). Before, the form failed to render because the logo, success icon and screenshot editor styles were injected via innerHTML.

Why

The icons were already built with DOM APIs and only serialized to HTML to be injected again, so rendering them as Preact components (like IconClose) and the styles as text removes the sink without needing a Trusted Types policy or any CSP change from users. The old success icon's clipPath attribute was invalid and never applied, so I dropped the clip instead of porting it.

The new integration suite is skipped for CDN bundles, which lazy load the feedback modal via script.src. That needs the sentry-sdk policy and comes in a follow-up.

Part of #24744

…ypes

The feedback form injected the Sentry logo, the success icon and the
screenshot editor styles via `dangerouslySetInnerHTML`, which is blocked on
pages that enforce `require-trusted-types-for 'script'`. Render the icons as
Preact components and the styles as text children instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: b1a8024 (PR test merge using develop at bd2d389)

Against: 36977c3 (develop) · base run #67320

⚠️ Baseline mismatch: 1 develop commit(s) in the baseline are missing from the PR build. Their size changes also affect this comparison. Compare commits. Rebase your PR onto the latest develop to compare against an up-to-date baseline.

Path Size % Change Change
@sentry/browser 30.23 kB - -
@sentry/browser - with treeshaking flags 28.43 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.33 kB - -
@sentry/browser (incl. Tracing) 52.81 kB - -
@sentry/browser (incl. Tracing Core) 40.33 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.81 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.69 kB - -
@sentry/browser (incl. Tracing, Replay) 92.86 kB -0.03% -26 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.67 kB -0.04% -28 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 97.23 kB +0.02% +14 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 110.67 kB -0.12% -130 B 🔽
@sentry/browser (incl. Feedback) 48.08 kB -0.2% -95 B 🔽
@sentry/browser (incl. sendFeedback) 30.81 kB - -
@sentry/browser (incl. FeedbackAsync) 35.84 kB - -
@sentry/browser (incl. Metrics) 31.55 kB - -
@sentry/browser (incl. Logs) 31.83 kB - -
@sentry/browser (incl. Metrics & Logs) 32.49 kB - -
@sentry/react 32.24 kB - -
@sentry/react (incl. Tracing) 55.45 kB - -
@sentry/vue 38.45 kB - -
@sentry/vue (incl. Tracing) 55.75 kB - -
@sentry/svelte 30.24 kB - -
@sentry/remix (Remix 3 client bundle) 58.46 kB - -
CDN Bundle 32.16 kB - -
CDN Bundle (incl. Tracing) 53.19 kB - -
CDN Bundle (incl. Logs, Metrics) 34.95 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.76 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.98 kB -0.05% -37 B 🔽
CDN Bundle (incl. Tracing, Replay) 91.07 kB -0.04% -28 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.69 kB -0.03% -26 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 96.48 kB -0.04% -29 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.04 kB -0.04% -31 B 🔽
CDN Bundle - uncompressed 93.91 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.26 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 164.88 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.36 kB -0.06% -118 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.41 kB -0.05% -119 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.04 kB -0.05% -119 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.34 kB -0.05% -119 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 296.96 kB -0.05% -119 B 🔽
@sentry/nextjs (client) 59.15 kB - -
@sentry/sveltekit (client) 54.06 kB - -
@sentry/core/server 45.28 kB - -
@sentry/core/browser 14.41 kB - -
@sentry/node 154.01 kB -0.01% -7 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.33 kB - -
@sentry/node - without tracing 88.81 kB - -
@sentry/node - without channel injection 142.98 kB -0.01% -5 B 🔽
@sentry/aws-serverless 99.41 kB -0.01% -4 B 🔽
@sentry/cloudflare (withSentry) - minified 208.5 kB - -
@sentry/cloudflare (withSentry) 483.88 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 1.02 MB - -
@sentry/nextjs/cloudflare (withSentry) - minified 233.74 kB - -

View base workflow run

@github-actions

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 25 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 39s Details

@msonnb

msonnb commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 273936e. Configure here.

@msonnb
msonnb marked this pull request as ready for review November 23, 2026 14:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant