Skip to content

Commit 448bddc

Browse files
Update csp.ts (#13953)
Co-authored-by: Emanuele Stoppa <[email protected]>
1 parent acb9b30 commit 448bddc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/seven-actors-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes a bug where quotes were not added to the 'strict-dynamic' CSP directive

packages/astro/src/runtime/server/render/csp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function renderCspContent(result: SSRResult): string {
3535
styleResources = result.styleResources.map((r) => `${r}`).join(' ');
3636
}
3737

38-
const strictDynamic = result.isStrictDynamic ? ` strict-dynamic` : '';
38+
const strictDynamic = result.isStrictDynamic ? ` 'strict-dynamic'` : '';
3939
const scriptSrc = `script-src ${scriptResources} ${Array.from(finalScriptHashes).join(' ')}${strictDynamic};`;
4040
const styleSrc = `style-src ${styleResources} ${Array.from(finalStyleHashes).join(' ')};`;
4141
return `${directives} ${scriptSrc} ${styleSrc}`;

0 commit comments

Comments
 (0)