Skip to content

Commit 7d8d119

Browse files
authored
fix: allow unsafe-eval for wasm (#238)
* fix: allow `unsafe-eval` for wasm * fmt * change to unsafe-wasm-eval * fmt * add back unsafe-eval in dev
1 parent 2532cbf commit 7d8d119

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

clients/web/csp.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { getCSP, SELF, NONE, UNSAFE_INLINE, UNSAFE_EVAL } from "csp-header";
1+
import {
2+
getCSP,
3+
SELF,
4+
NONE,
5+
UNSAFE_INLINE,
6+
WASM_UNSAFE_EVAL,
7+
UNSAFE_EVAL,
8+
} from "csp-header";
29

310
export function generateCSP(isDev = false) {
411
return getCSP({
@@ -8,7 +15,7 @@ export function generateCSP(isDev = false) {
815
directives: {
916
"default-src": [SELF],
1017
"frame-src": [SELF],
11-
"script-src": isDev ? [SELF, UNSAFE_EVAL] : [SELF],
18+
"script-src": isDev ? [SELF, UNSAFE_EVAL] : [SELF, WASM_UNSAFE_EVAL],
1219
"style-src": isDev ? [SELF, UNSAFE_INLINE] : [SELF],
1320
"connect-src": [SELF, "127.0.0.1", "127.0.0.1:*", "ws://localhost:5173/"],
1421
"img-src": [SELF],

0 commit comments

Comments
 (0)