Repository navigation
feat(shared,plugins): allow the Google Fonts stylesheet in the page CSP (SUPER-1995) - #7474
Conversation
…SP (SUPER-1995) "My CSP carves out exactly one exception for Google Fonts; yours blocks everything, so system stack is the ceiling on typography." — font-src already allowed any https font file, but style-src had zero remote allowance at all, so the <link rel="stylesheet" href="https://fonts. googleapis.com/..."> tag everyone copies off Google Fonts' own site was silently dropped, and the page skill told people to hand-inline @font-face instead. style-src now allows fonts.googleapis.com specifically — nothing broader. It only ever serves @font-face CSS, and font-src already gates the actual font files it points at. Updated the page skill's content-policy section and failure table to match, and added a unit test for pageContentSecurityPolicy since it had none. Claude-Session: https://claude.ai/code/session_01V89xJG2G36ArAT9XM9WygA
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe page content security policy now permits stylesheets from ChangesGoogle Fonts CSP support
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Merge Risk: ⚪ Minimal · up to Google Fonts stylesheet loading is enabled without widening remote script access, and the accompanying guidance and tests match the policy. 🚥 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 |
|
No installed development build can load this pull request as an update: its native fingerprint is |
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
…1995) The bundled-skills test enforces the repo prose rule (no em dashes) on every skill body, and the Google Fonts exception sentence added one. Claude-Session: https://claude.ai/code/session_016KpZFcvBW7ZMS9VjG2VrKs
What
"No remote fonts. My CSP carves out exactly one exception for Google Fonts; yours blocks everything, so system stack is the ceiling on typography." — feedback from an agent comparing Superset's page CSP against Claude's own artifact CSP.
Why
pageContentSecurityPolicy(packages/shared/src/usercontent/csp.ts):font-src 'self' data: https:already allows any https font file — this part was never the problem.style-src 'self' 'unsafe-inline'had zero remote allowance — so the standard<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=...">snippet everyone copies straight off Google Fonts' own picker was silently dropped. Thepageskill's own docs already knew this and told people to hand-inline@font-faceinstead.Fix
style-srcnow allowshttps://fonts.googleapis.comspecifically — nothing broader. That host only ever serves@font-faceCSS; the actual font files it points at still go through the existing (already-permissive)font-src.pageskill's content-policy bullet and failure-table row to describe the new behavior instead of the old workaround.csp.test.ts—pageContentSecurityPolicyhad no direct test coverage before this.Testing
bun run --filter=@superset/shared typecheck— passbun run --filter=@superset/shared test— 1023/1023 pass (including the new 4)bun run check:plugins— passesbiome checkon touched files — cleanCloses SUPER-1995.
https://claude.ai/code/session_01V89xJG2G36ArAT9XM9WygA
Summary by cubic
Allows the Google Fonts stylesheet host in the page CSP so standard Google Fonts
<link>tags load instead of being silently dropped.style-srcnow allows onlyhttps://fonts.googleapis.com; other remote stylesheets and scripts remain blocked, and remote font files still go through the existingfont-srcrule. Updates thepageskill docs to match and addspageContentSecurityPolicytests. Closes SUPER-1995.Written for commit 298be39. Summary will update on new commits.
Summary by CodeRabbit
New Features
@font-faceremain supported.Documentation