Skip to content

Commit 3c9dab3

Browse files
fix: Fix CSP for monaco editor (coder#5358)
1 parent ce76d9d commit 3c9dab3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

site/site.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,12 @@ func cspHeaders(next http.Handler) http.Handler {
266266
CSPDirectiveDefaultSrc: {"'self'"},
267267
CSPDirectiveConnectSrc: {"'self'"},
268268
CSPDirectiveChildSrc: {"'self'"},
269-
CSPDirectiveScriptSrc: {"'self'"},
270-
CSPDirectiveFontSrc: {"'self'"},
271-
CSPDirectiveStyleSrc: {"'self' 'unsafe-inline'"},
269+
// https://cdn.jsdelivr.net is used by monaco editor on FE for Syntax Highlight
270+
// https://github.com/suren-atoyan/monaco-react/issues/168
271+
CSPDirectiveScriptSrc: {"'self' https://cdn.jsdelivr.net"},
272+
// data: is used by monaco editor on FE for Syntax Highlight
273+
CSPDirectiveFontSrc: {"'self' data:"},
274+
CSPDirectiveStyleSrc: {"'self' 'unsafe-inline'"},
272275
// object-src is needed to support code-server
273276
CSPDirectiveObjectSrc: {"'self'"},
274277
// blob: for loading the pwa manifest for code-server

0 commit comments

Comments
 (0)