fix(query-devtools): set window.__nonce__ in setupStyleSheet#10736
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesCSP Nonce Propagation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
Actionable comments posted: 0 |
|
View your CI Pipeline Execution ↗ for commit 57d2700 ☁️ Nx Cloud last updated this comment at |
🎯 Changes
Fixes #10820
Problem
When passing
styleNonceto<ReactQueryDevtools>, user still receive CSP violations for thedevtools
<style>element even though the nonce prop is correctly provided.Root cause
The devtools use goober for CSS-in-JS. Goober uses
window.__nonce__asits CSP hook, reading it every time it creates or accesses its style element. Since
setupStyleSheetnever set it, goober always overwrote the nonce with
undefined, causing the CSP violation.Solution
Set
window.__nonce__insidesetupStyleSheetbefore the element is created or inserted:✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
Tests