Skip to content

Commit b1da9e0

Browse files
committed
fix(docs): update CSP header
1 parent 1c8ec2e commit b1da9e0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

apps/docs/src/middleware.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { NextResponse, type NextRequest } from "next/server";
22

3-
// file: middleware.ts
43
export function middleware(request: NextRequest) {
54
const requestHeaders = new Headers(request.headers);
65
const response = initResponse();
@@ -45,18 +44,26 @@ function getContentSecurityPolicyHeaderValue(nonce: string, reportUri: string):
4544
"frame-ancestors": [`'none'`],
4645
"font-src": [`'self'`],
4746
"form-action": [`'self'`],
48-
"frame-src": [`'self'`],
47+
"frame-src": [`'self'`, "*.youtube.com"],
4948
"connect-src": [`'self'`],
50-
"img-src": [`'self'`, "cdn.usefathom.com", "github.com"],
49+
"img-src": [
50+
`'self'`,
51+
"cdn.usefathom.com",
52+
"github.com",
53+
"storage.googleapis.com",
54+
"stripe.com",
55+
"avatars.githubusercontent.com",
56+
],
5157
"manifest-src": [`'self'`],
5258
"object-src": [`'none'`],
5359
"report-uri": [reportUri], // for old browsers like Firefox
5460
"report-to": ["csp"], // for modern browsers like Chrome
5561
"script-src": [
5662
`'nonce-${nonce}'`,
63+
`'unsafe-inline'`, // ignored by browsers that support 'notices/hashes`
5764
`'strict-dynamic'`, // force hashes and nonces over domain host lists
5865
],
59-
"style-src": [`'self'`, `'unsafe-inline'`],
66+
"style-src": [`'self'`, `'unsafe-inline'`, "*.lemonsqueezy.com", "fonts.googleapis.com"],
6067
};
6168

6269
if (process.env.NODE_ENV === "development") {

0 commit comments

Comments
 (0)