fix(query-devtools): set window.__nonce__ in setupStyleSheet#10831
fix(query-devtools): set window.__nonce__ in setupStyleSheet#10831raashish1601 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds global nonce tracking to the ChangesGlobal nonce tracking in setupStyleSheet
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Description
This fixes CSP
styleNoncehandling in Query Devtools.Problem
setupStyleSheetsets a nonce attribute on the injected<style id=_goober>, but it never setswindow.__nonce__. goober (v2.1.17+) readswindow.__nonce__when accessing style nodes and overwrites the nonce, which can clear it and break CSP.Fix
window.__nonce__whensetupStyleSheetreceives a nonce.packages/query-devtools/src/__tests__/utils.test.tsto assertwindow.__nonce__is set.Validation
npx pnpm@11 --filter @tanstack/query-devtools exec vitest run src/__tests__/utils.test.tsSummary by CodeRabbit
Tests
Bug Fixes