Skip to content

Security: External stylesheet import can weaken CSP and leak client metadata#6292

Open
tuanaiseo wants to merge 1 commit intoparca-dev:mainfrom
tuanaiseo:contribai/fix/security/external-stylesheet-import-can-weaken-cs
Open

Security: External stylesheet import can weaken CSP and leak client metadata#6292
tuanaiseo wants to merge 1 commit intoparca-dev:mainfrom
tuanaiseo:contribai/fix/security/external-stylesheet-import-can-weaken-cs

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

The CSS imports Google Fonts from a third-party origin at runtime. This introduces external network dependency and can expose user IP/user-agent/referrer metadata to the third party. In hardened deployments, this often conflicts with strict CSP and privacy requirements.

Severity: low
File: ui/packages/app/web/src/style/profile.css

Solution

Self-host required fonts and serve them from the same origin. Update CSP to restrict style-src/font-src to trusted origins only, ideally eliminating third-party font/CDN dependencies.

Changes

  • ui/packages/app/web/src/style/profile.css (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

The CSS imports Google Fonts from a third-party origin at runtime. This introduces external network dependency and can expose user IP/user-agent/referrer metadata to the third party. In hardened deployments, this often conflicts with strict CSP and privacy requirements.

Affected files: profile.css

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
@tuanaiseo tuanaiseo requested a review from a team as a code owner April 2, 2026 14:04
@yomete
Copy link
Copy Markdown
Contributor

yomete commented Apr 2, 2026

Thanks for the PR!

However, this only removes the Google Fonts @import without adding the self-hosted @font-face declarations or bundling the .woff2 files. This would change the appearance of the UI since the Poppins and Roboto Mono fonts are actually used.

A complete migration would need to:

  • Bundle the relevant .woff2 files into the repo (e.g. we can do a public/fonts/ folder and put them in there)
  • Add @font-face declarations pointing to those local files
  • Then remove the Google Fonts import

Happy to review a revised PR that includes all three steps!

@yomete
Copy link
Copy Markdown
Contributor

yomete commented Apr 10, 2026

Hey @tuanaiseo, just following up on this. It's been about a week with no update.

If you're still interested in completing this, happy to wait a bit longer. Otherwise I'll close this and put up a complete PR myself.

Let me know either way!

yomete added a commit that referenced this pull request Apr 13, 2026
Replace the runtime @import of Google Fonts with self-hosted woff2 files
served from public/fonts/. This removes the external network dependency
and prevents leaking client metadata (IP, user-agent, referrer) to
third-party origins, improving CSP compatibility and privacy.

- Bundle Poppins (weights 100-600) and Roboto Mono (400) as woff2
- Add @font-face declarations pointing to local files
- Remove the Google Fonts @import
- Include OFL license file for bundled fonts

Relates to #6292

Signed-off-by: Yomi <yomi@users.noreply.github.com>
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