Skip to content

support trusted types enforcement in react-start#6527

Draft
hybrist wants to merge 1 commit intoTanStack:mainfrom
hybrist:tt-route-transition
Draft

support trusted types enforcement in react-start#6527
hybrist wants to merge 1 commit intoTanStack:mainfrom
hybrist:tt-route-transition

Conversation

@hybrist
Copy link

@hybrist hybrist commented Jan 27, 2026

Currently @tanstack/react-start fails during route transitions when trusted types are enabled. This makes it impossible to use it with strict CSPs that enable all the "XSS-prevention bells and whistles".

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

export const requiresTrustedTypes: boolean =
import.meta.env.VITE_CSP === 'strict'

declare const trustedTypes: any
Copy link
Author

Choose a reason for hiding this comment

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

These types should make it into TS proper soon™ given that there's now two engines (Safari + Chromium) that ship the feature.

@hybrist hybrist force-pushed the tt-route-transition branch from 2ffe5fb to 272ffe5 Compare February 1, 2026 22:41
@hybrist hybrist force-pushed the tt-route-transition branch from 272ffe5 to 8373cb1 Compare February 1, 2026 22:42
@hybrist
Copy link
Author

hybrist commented Feb 1, 2026

@schiller-manuel Updated with an integration into the existing CSP test. The checked in test results show the general issue (client-side script creation after hydration).


declare const trustedTypes: any

const tanStackPolicy: TanStackPolicy = {
Copy link
Author

Choose a reason for hiding this comment

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

NOTE: This policy should really be locked down, at least to some extent. E.g. createHTML shouldn't just bless any string when its purpose is to bless static strings like ''.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant