-
Notifications
You must be signed in to change notification settings - Fork 0
/
csp.js
38 lines (36 loc) · 911 Bytes
/
csp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const csp = {
"default-src": ["'self'"],
"script-src": [
"'self'",
"plausible.io",
...(process.env.NODE_ENV === "development"
? [
"'unsafe-eval'", // node_modules/@next/react-refresh-utils/runtime.js
]
: []),
],
"style-src": [
"'self'",
"'unsafe-inline'", // emotion
"fonts.googleapis.com",
],
"connect-src": [
"'self'",
"plausible.io/api/",
"https://forrigebok.no/",
// For Safari, se https://bugs.webkit.org/show_bug.cgi?id=201591
...(process.env.NODE_ENV === "development" ? ["ws://localhost:3000"] : []),
],
"font-src": ["fonts.gstatic.com"],
"img-src": [
"'self'",
"data:", // next-image
"media.aja.bs.no",
"www.cappelendamm.no/",
"aja.bs.no",
],
};
const stringified = Object.entries(csp)
.map((entry) => `${entry[0]} ${entry[1].join(" ")}`)
.join("; ");
module.exports = stringified;