Skip to content

Commit 84522aa

Browse files
authored
feat: add strictDynamic as a config option (#129)
1 parent 967b695 commit 84522aa

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

manifest.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
default: true
66
- name: reportUri
77
description: The relative or absolute URL to report any violations. If not defined, violations are reported to the __csp-violations function, which this plugin deploys.
8+
- name: strictDynamic
9+
description: When true, dynamically trust scripts via nonce or hash instead of static allowlists, enhancing security.
10+
default: true
811
- name: unsafeEval
912
description: When true, adds 'unsafe-eval' to CSP for easier adoption. Set to false to have a safer policy if your code and code dependencies does not use eval().
1013
default: true

src/__csp-nonce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ params.reportUri = params.reportUri || "/.netlify/functions/__csp-violations";
2424
// @ts-ignore
2525
params.distribution = Netlify.env.get("CSP_NONCE_DISTRIBUTION");
2626

27-
params.strictDynamic = true;
27+
params.strictDynamic = params.strictDynamic ?? true;
2828
params.unsafeInline = params.unsafeInline ?? true;
2929
params.self = params.self ?? true;
3030
params.https = true;

0 commit comments

Comments
 (0)