@netlify/plugin-csp-nonce 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@netlify/plugin-csp-nonce",
4
- "version": "1.2.7",
4
+ "version": "1.2.8",
5
5
  "description": "Use a nonce for the script-src and style-src directives of your Content Security Policy.",
6
6
  "main": "index.js",
7
7
  "repository": {
@@ -92,7 +92,9 @@ const handler = async (request: Request, context: Context) => {
92
92
  const d = directive.trim();
93
93
  // intentionally add trailing space to avoid mangling `script-src-elem`
94
94
  if (d.startsWith("script-src ")) {
95
- return d.replace("script-src ", scriptSrc);
95
+ // append with trailing space to include any user-supplied values
96
+ // https://github.com/netlify/plugin-csp-nonce/issues/72
97
+ return d.replace("script-src ", `${scriptSrc} `).trim();
96
98
  }
97
99
  // intentionally omit report-uri: theirs should take precedence
98
100
  return d;