Skip to content

feat(shared,plugins): allow the Google Fonts stylesheet in the page CSP (SUPER-1995) - #7474

Merged
Kitenite merged 2 commits into
mainfrom
fix/super-1995-google-fonts-csp
Sep 12, 2026
Merged

Kitenite merged 2 commits into
mainfrom
fix/super-1995-google-fonts-csp

Conversation

@harshithmullapudi

@harshithmullapudi harshithmullapudi commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

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. The page skill's own docs already knew this and told people to hand-inline @font-face instead.

Fix

  • style-src now allows https://fonts.googleapis.com specifically — nothing broader. That host only ever serves @font-face CSS; the actual font files it points at still go through the existing (already-permissive) font-src.
  • Updated the page skill's content-policy bullet and failure-table row to describe the new behavior instead of the old workaround.
  • Added csp.test.ts — pageContentSecurityPolicy had no direct test coverage before this.

Testing

  • bun run --filter=@superset/shared typecheck — pass
  • bun run --filter=@superset/shared test — 1023/1023 pass (including the new 4)
  • bun run check:plugins — passes
  • biome check on 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.

Written for commit 298be39. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Superset Pages can now load stylesheets from Google Fonts.
    • Inline font files loaded through @font-face remain 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.

…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
@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 91d22e22-9822-436d-a266-ee73375a0973

📥 Commits

Reviewing files that changed from the base of the PR and between 427e587 and 298be39.

📒 Files selected for processing (1)
  • plugins/superset/skills/page/SKILL.md

📝 Walkthrough

Walkthrough

The page content security policy now permits stylesheets from fonts.googleapis.com. Tests cover the directive behavior. Superset Pages guidance describes the Google Fonts exception and updates the font troubleshooting entry.

Changes

Google Fonts CSP support

Layer / File(s) Summary
CSP behavior, tests, and guidance
packages/shared/src/usercontent/csp.ts, packages/shared/src/usercontent/csp.test.ts, plugins/superset/skills/page/SKILL.md
style-src permits https://fonts.googleapis.com. Tests cover Google Fonts stylesheets, remote scripts, HTTPS fonts, and frame-ancestors. The page guidance documents the stylesheet exception and updated troubleshooting text.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 427e5

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)
Check name Status Explanation
Title check ✅ Passed The title uses conventional commit format and clearly identifies the scoped CSP change that allows Google Fonts stylesheets.
Description check ✅ Passed The description explains what changed, why it changed, the implementation scope, documentation updates, tests run, and linked issue. The template checklist is omitted, but the required information is …
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/super-1995-google-fonts-csp

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.

@expo

expo Bot commented Sep 12, 2026

Copy link
Copy Markdown

No installed development build can load this pull request as an update: its native fingerprint is 59c8ca563d5c and no development build has it. Add the mobile-build label to build one.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) ✅ View Branch
Vercel API (Vercel) ✅ Open Preview
Vercel Web (Vercel) ✅ Open Preview
Vercel Marketing (Vercel) ✅ Open Preview
Vercel Admin (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

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
@Kitenite
Kitenite merged commit ab07d25 into main Sep 12, 2026
13 of 15 checks passed
@Kitenite
Kitenite deleted the fix/super-1995-google-fonts-csp branch September 12, 2026 18:02

This branch was previously deployed

1 inactive deployment
preview — 298be390 Deployed Sep 12, 2026 by Kitenite via Deploy Docs #9728
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants