Skip to content

Commit 06e80c5

Browse files
jiunbaeclaude
andcommitted
Tighten CSP scheme handling for Google Fonts
Browsers refused to load Noto Sans KR woff2 files served from fonts.gstatic.com because the CSP listed the host without a scheme: font-src fonts.gstatic.com *.gstatic.com Some browsers interpret the unprefixed host as same-scheme as the page (http when the wiki is behind plain HTTP), but the actual font is delivered over https — so the request was blocked. Adding https:// explicitly + data: (for inline icon fonts that some KaTeX/highlight themes embed) makes the policy work the same way regardless of how the site is served. Also normalized style-src to use scheme-prefixed hosts for cdn.jsdelivr.net and fonts.googleapis.com for consistency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4a60f86 commit 06e80c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ export function startServer(root: string, port: number, host: string): void {
732732

733733
if (await staticFile.exists()) {
734734
const isHtml = pathname.endsWith(".html");
735-
const cspValue = "default-src 'self'; script-src 'self' 'unsafe-inline' cdn.jsdelivr.net d3js.org static.cloudflareinsights.com; style-src 'self' 'unsafe-inline' cdn.jsdelivr.net fonts.googleapis.com; font-src fonts.gstatic.com *.gstatic.com; img-src * data:; connect-src 'self' cloudflareinsights.com";
735+
const cspValue = "default-src 'self'; script-src 'self' 'unsafe-inline' cdn.jsdelivr.net d3js.org static.cloudflareinsights.com; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.googleapis.com; font-src https://fonts.gstatic.com https://*.gstatic.com data:; img-src * data:; connect-src 'self' cloudflareinsights.com";
736736
if (isHtml) {
737737
const queryToken = url.searchParams.get("token");
738738
const isAuthed = isAuthenticated(req, url);

0 commit comments

Comments
 (0)