@@ -87,34 +87,6 @@ export async function buildFastifyApp(deps: AppDeps): Promise<FastifyInstance> {
8787 } )
8888 ) ;
8989
90- // CSP Header Injection (optional, controlled by `relaxCsp` config)
91- //
92- // xterm.js and Monaco Editor internally use `eval` and `new Function` for
93- // performance optimizations (e.g., JIT-compiled rendering loops). When a
94- // browser extension (e.g., uBlock Origin, AdGuard) injects a strict CSP,
95- // these libraries silently fail:
96- // - xterm.js: terminal shows only "[Process exited with code 0]"
97- // - Monaco Editor: code editor panel renders blank
98- //
99- // When `relaxCsp: true`, we inject a permissive CSP header that allows
100- // 'unsafe-eval' and 'unsafe-inline', plus WebSocket connections (ws:/wss:).
101- // This is intended for local development scenarios where browser extensions
102- // interfere. For production, leave this disabled and configure CSP at the
103- // reverse proxy level.
104- if ( deps . config . relaxCsp ) {
105- app . addHook ( "onRequest" , async ( _request , reply ) => {
106- reply . header (
107- "Content-Security-Policy" ,
108- "default-src 'self'; " +
109- "script-src 'self' 'unsafe-inline' 'unsafe-eval'; " +
110- "style-src 'self' 'unsafe-inline'; " +
111- "connect-src 'self' ws: wss:; " +
112- "img-src 'self' data: blob:; " +
113- "font-src 'self' data:;"
114- ) ;
115- } ) ;
116- }
117-
11890 await app . register ( compress ) ;
11991
12092 await app . register ( multipart , {
0 commit comments