Skip to content

Commit ddcdb14

Browse files
authored
fix(csp): remove shadowed permissive policy from workflow execute routes (#10050)
The execute routes' CSP entry was always overridden by the later catch-all header rule (Next applies the last matching rule per key), so the default-src * policy was never served. Delete it so the config reflects the policy actually in effect; COEP/COOP on those routes are unchanged.
1 parent eea089d commit ddcdb14

2 files changed

Lines changed: 0 additions & 16 deletions

File tree

‎apps/sim/lib/core/security/csp.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,6 @@ export function getMainCSPPolicy(): string {
319319
return buildCSPString(buildTimeCSPDirectives)
320320
}
321321

322-
/**
323-
* Permissive CSP for workflow execution endpoints
324-
*/
325-
export function getWorkflowExecutionCSPPolicy(): string {
326-
return "default-src * 'unsafe-inline' 'unsafe-eval'; connect-src *;"
327-
}
328-
329322
/**
330323
* CSP for embeddable chat pages.
331324
* Extends the shared embed policy with Microsoft Office.js sources so the

‎apps/sim/next.config.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
FILE_DELIVERY_CSP_PATH_PATTERN,
88
getChatEmbedCSPPolicy,
99
getMainCSPPolicy,
10-
getWorkflowExecutionCSPPolicy,
1110
} from './lib/core/security/csp'
1211
import { LANDING_ROUTES } from './lib/landing/routes'
1312
import { LIBRARY_MERGED_SLUGS, LIBRARY_MOVED_BLOG_SLUGS } from './lib/library/retired-slugs'
@@ -326,21 +325,13 @@ const nextConfig: NextConfig = {
326325
headers: [
327326
{ key: 'Cross-Origin-Embedder-Policy', value: 'unsafe-none' },
328327
{ key: 'Cross-Origin-Opener-Policy', value: 'unsafe-none' },
329-
{
330-
key: 'Content-Security-Policy',
331-
value: getWorkflowExecutionCSPPolicy(),
332-
},
333328
],
334329
},
335330
{
336331
source: '/api/v2/workflows/:workflowId/execute',
337332
headers: [
338333
{ key: 'Cross-Origin-Embedder-Policy', value: 'unsafe-none' },
339334
{ key: 'Cross-Origin-Opener-Policy', value: 'unsafe-none' },
340-
{
341-
key: 'Content-Security-Policy',
342-
value: getWorkflowExecutionCSPPolicy(),
343-
},
344335
],
345336
},
346337
{

0 commit comments

Comments
 (0)