Repository navigation
feat(web): self-host web fonts so no page loads from Google - #905
Merged
Merged
Conversation
Contributor
Author
Code Review — round 1 — PASSNo critical issues. The change follows the Tech Design point by point:
The main behavior has tests at the layers the Tech Design asks for:
All factories, traits, route helpers and test seams these tests use exist on Non-critical suggestions
|
dvislov
marked this pull request as ready for review
November 30, 2026 12:14
The OFL-licensed variable woff2 files from @fontsource-variable 5.3.0, with the same unicode subsets Google Fonts serves, and one stylesheet under the family names the frontend theme uses. The v1 path segment is the cache buster: public/ is served with a one-year max-age. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Aixle Flow <[email protected]> Signed-off-by: Dmitry Vislov <[email protected]>
Every page, the static error pages and the admin panel sent each visitor's IP address to Google for fonts. They now link /fonts/v1/fonts.css, the mailer links no web font, and the CSP drops the Google hosts and the blanket https: source from font-src and style-src. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Aixle Flow <[email protected]> Signed-off-by: Dmitry Vislov <[email protected]>
The Google-font scan read every file under app/frontend as UTF-8 and raised on the agent-logo PNGs. Read them with File.binread instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Aixle Flow <[email protected]> Signed-off-by: Dmitry Vislov <[email protected]>
dvislov
force-pushed
the
feature/353-self-host-web-fonts
branch
from
November 30, 2026 12:15
cb1e7ae to
2ff2ebe
Compare
A font bundled by Vite is served from the asset host in production, where the policy is enforced, so font-src matches script-src and style-src. The partial takes no locals now; strict locals make a leftover `families:` call fail. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every Flow page loaded Inter, JetBrains Mono and Spline Sans Mono from
fonts.googleapis.com/fonts.gstatic.com, so each visitor's browser sent its IP address to Google (a GDPR concern for EU customers). Fonts are now served from our own origin.Card: https://flow.aixle.com/company/projects/56/board?n=353
What changed
public/fonts/v1/: the OFL variablewoff2files from@fontsource-variable/{inter,jetbrains-mono,spline-sans-mono}5.3.0 (same subsets Google serves: Inter and JetBrains Mono latin/latin-ext/cyrillic/cyrillic-ext/greek/vietnamese, plus greek-ext for Inter; Spline Sans Mono latin/latin-ext), onefonts.csswith the family names the Mantine theme uses (Inter,JetBrains Mono,Spline Sans Mono), the moved"Inter Fallback"metric override, the OFL texts and a README.v1is the cache buster (public/is cached for a year); a font update goes tov2/. ~420 KB in total.shared/_web_fonts: a preload of the Inter latin face plus the stylesheet, same-origin paths. Thefamilies:local is gone and the 6 callers render it without arguments.public/400|406-unsupported-browser|422|500.html): link/fonts/v1/fonts.cssinstead of Google and drop their inline fallback copy.FONT_SANSfallback stack and the Outlook Segoe UI pin stay.font-srcis this origin, the asset host anddata:;style-srcis this origin, the asset host and'unsafe-inline'.:httpsis dropped from both, since it would still allow the Google hosts. Staging and production setCSP_ENFORCE, so there the new policy blocks from the first deploy rather than reporting: watch Sentry CSP issues after it. No external stylesheet or font is left inapp/orpublic/.shared/_web_fontsdeclares strict locals(), so a leftoverfamilies:call fails instead of being ignored.THIRD-PARTY-LICENSES.mdrow,CHANGELOG.mdentry (no product area: the change spans every page rather than one area).Tests
test/integration/self_hosted_fonts_test.rb(new): landing, privacy policy, login (Inertia layout), admin users page, 404 and public asset viewer have nogoogleapis/gstaticand link/fonts/v1/fonts.css.test/lib/self_hosted_font_files_test.rb(new): no view/frontend file/static page references Google font hosts; everyurl()infonts.cssand the preload point to existing files; family names; each static error page links the stylesheet.test/integration/content_security_policy_test.rb:font-srcis exactly'self' data:, no Google hosts, nohttps:instyle-src.test/mailers/password_mailer_test.rb: the email has no Google link and keeps theFONT_SANSstack.Checks
bin/rails test,make lint_check_all(rubocop, brakeman, eslint, tsc) andmake check_alldid not run. CI is the first run of the new and changed tests.rg 'fonts\.(googleapis|gstatic)'overapp/,public/,config/: no matches left; everyurl()infonts.cssresolves to a committed file (checked with a script).🤖 Generated with Claude Code