Repository navigation
Description
Summary
Every resource a page loads should come from the site itself. Nothing enforces that today. 95 images on eight archived posts were hotlinked from hosts that no longer served them, and no check noticed. They came to light only when #501 surveyed every origin the site loads for the Content-Security-Policy. #513 restores them under each post's own media. This issue makes "served locally" a build gate, so the next off-site reference fails CI instead of waiting for someone to notice a broken page.
Why nothing caught the dead images
- The migration's localize step looked for two hosts only.
capture/localize-external.pymatchedggpht.comandgoogleusercontent.com. Thedocs.google.com/File?id=images and theelcolighting.comimage were outside its pattern, so it neither fetched them nor reported skipping them. - The parity gate checks local references only.
check-url-parity.pyproves every/media/and/external/reference resolves. An absolute URL on another host is not a local reference, so it is never examined. - The CSP build gate does not cover images, styles, or fonts.
check-csp-scripts.pychecks scripts, frames, media, and objects against the policy. Once Enforce a Blog Content-Security-Policy Behind a Script Hash Gate #514 setimg-src 'self', only the hand-runcheck-csp-browser.pysaw the blocked images, and they went onto its allow list as known exceptions. - No gate fetches an off-site URL, by design, so a dead one and a live one look the same to the build.
What still loads from elsewhere
A scan of the built HTML and CSS on the #513 branch finds one remaining source, Google Fonts, on every page of both sites:
- Blog.
layouts/_partials/extend_head.htmlloads Lexend 400 fromfonts.googleapis.com, which serves the font files fromfonts.gstatic.com. - Family site. Both pages load Cormorant Garamond (500, 600, 700, 500 italic) and EB Garamond (400, 500, 400 italic) the same way.
sites/viljoen.family/README.mdalready lists self-hosting under "Ideas Not Yet Done".
Decided, 2026-10-25: both sites self-host their fonts. The fonts are under the SIL Open Font License, which permits redistribution and self-hosting as long as the license travels with the files. Browsers have partitioned their HTTP caches by site since about 2020, so a shared Google CDN copy no longer saves a reader anything. Each page view to Google also sends the reader's IP address and referrer to a third party. Self-hosting removes both Google hosts from both policies.
Work
- Self-host the fonts, as its own pull request. Serve
woff2files for each family and weight in use, with each font'sOFL.txt, from the site's own tree. Cover the Latin and Latin Extended ranges the English and Afrikaans text needs. Replace the Google<link>andpreconnectlines with local@font-facerules. Tighten both policies inchecks/security-headers.txtanddeploy/Caddyfiletostyle-src 'self' 'unsafe-inline'andfont-src 'self', and drop the family policy's Googleconnect-srchosts. Run the CSP browser check on both sites before the pull request opens. - Fail the build on any subresource from another origin, in the release build that CI runs. Cover the built HTML and CSS of both sites:
imgsrcandsrcset,picturesource,video,audio, andtracksources and posters,script,iframe,embed,object,linkwith a loadingrel(stylesheet,icon,preload,modulepreload,manifest,preconnect),styleattributes,<style>blocks, and CSSurl()and@import. A plain<a href>to another site stays allowed, since it loads nothing. Extendingcheck-csp-scripts.pytoimg-src,style-src, andfont-srcis one way to do this, and a separate check is another. With the fonts local, the gate needs no exception list.
Done
Every page on both sites loads only from its own origin, both policies name no other host, and the release build fails when a change adds anything served from elsewhere.
🤖 Generated with Claude Code
Activity
ptr727 commentedon Oct 25, 2026
Decided, 2026-10-25: the gate extends the CSP gate.
checks/check-csp-scripts.pybecomeschecks/check-csp.py. It checks every fetch a page makes on both sites, against each site's own policy: images andsrcset,linkloads, CSSurl()and@import,styleattributes, and fonts. It also fails where either policy names a host. One scanner then reads the pages, and each policy is the one statement of what a site may load. The alternative was a separate local-only check, which would have repeated the HTML scan the CSP gate already does.Step 1, the self-hosted fonts, is #531.
🤖 Generated with Claude Code
Serve Both Sites' Fonts From the Sites Themselves (#531)
Check Every Fetch on Both Sites Against Its Policy, and Refuse a Name…