Skip to content

Commit 461b41e

Browse files
committed
feat: update CSP directives to support external Google Fonts and Cloudflare Insights while enabling client-side endpoint connectivity
1 parent a00f48b commit 461b41e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

data/metrics.sqlite

0 Bytes
Binary file not shown.

src/server.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ app.use(
3939
contentSecurityPolicy: {
4040
directives: {
4141
defaultSrc: ["'self'"],
42-
scriptSrc: ["'self'"],
43-
styleSrc: ["'self'", "'unsafe-inline'"], // inline styles needed for SVG previews on the index page
44-
imgSrc: ["'self'", 'data:'], // data: URIs used in SVG <image> elements
45-
fontSrc: ["'self'"],
46-
connectSrc: ["'none'"], // no client-side fetch/XHR allowed
42+
scriptSrc: ["'self'", "'unsafe-inline'", "https://static.cloudflareinsights.com"], // allow local script and Cloudflare Insights
43+
styleSrc: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"], // inline styles and Google Fonts
44+
imgSrc: ["'self'", "data:"], // data: URIs used in SVG <image> elements
45+
fontSrc: ["'self'", "https://fonts.gstatic.com"], // local and Google Fonts
46+
connectSrc: ["'self'"], // allow client-side fetch/XHR to own endpoints (e.g. metrics)
4747
objectSrc: ["'none'"],
4848
frameSrc: ["'none'"],
4949
baseUri: ["'self'"],

0 commit comments

Comments
 (0)