@netlify/plugin-csp-nonce 1.2.7 → 1.2.9
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/README.md +1 -0
- package/package.json +1 -1
- package/src/__csp-nonce.ts +4 -2
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ If your HTML does not contain the `nonce` attribute on the `<script>` tags that
|
|
|
92
92
|
- The request method is `GET`
|
|
93
93
|
- The `content-type` response header starts with `text/html`
|
|
94
94
|
- The path of the request is satisfied by the `path` config option, and not included in the `excludedPath` config option
|
|
95
|
+
- This site does not use [Split Testing](https://docs.netlify.com/site-deploys/split-testing/). There is a [known limitation](https://docs.netlify.com/edge-functions/limits/#feature-limitations) that requests to sites with Split Testing enabled will not execute edge functions.
|
|
95
96
|
|
|
96
97
|
### Controlling rollout
|
|
97
98
|
|
package/package.json
CHANGED
package/src/__csp-nonce.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|
|
@@ -177,7 +179,7 @@ const excludedExtensions = [
|
|
|
177
179
|
|
|
178
180
|
export const config: Config = {
|
|
179
181
|
path: params.path,
|
|
180
|
-
excludedPath: ["/.netlify
|
|
182
|
+
excludedPath: ["/.netlify*", `**/*.(${excludedExtensions.join("|")})`]
|
|
181
183
|
.concat(params.excludedPath)
|
|
182
184
|
.filter(Boolean),
|
|
183
185
|
handler,
|