feat(shared,plugins): allow the Google Fonts stylesheet in the page CSP (SUPER-1995)
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.- Updated the
pageskill's content-policy bullet and failure-table row to describe the new behavior instead of the old workaround. - Added
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 — clean
Closes 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-src now allows only https://fonts.googleapis.com; other remote stylesheets and scripts remain blocked, and remote font files still go through the existing font-src rule. Updates the page skill docs to match and adds pageContentSecurityPolicy tests. Closes SUPER-1995.
Summary by CodeRabbit
-
New Features
- Superset Pages can now load stylesheets from Google Fonts.
- Inline font files loaded through
@font-faceremain supported. - Remote stylesheets from other hosts continue to be blocked.
-
Documentation
- Updated content-policy guidance and troubleshooting information to reflect Google Fonts stylesheet support and restrictions on other remote stylesheet links.