@adobe/helix-html-pipeline 6.24.0 → 6.24.2
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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/robots-pipe.js +2 -0
- package/src/steps/csp.js +35 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [6.24.2](https://github.com/adobe/helix-html-pipeline/compare/v6.24.1...v6.24.2) (2025-04-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Add script nonce to <link as=script> ([#850](https://github.com/adobe/helix-html-pipeline/issues/850)) ([182f281](https://github.com/adobe/helix-html-pipeline/commit/182f2816c018ed4e68af44ff3738ca9722984455))
|
|
7
|
+
|
|
8
|
+
## [6.24.1](https://github.com/adobe/helix-html-pipeline/compare/v6.24.0...v6.24.1) (2025-03-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* support aem-gcp.page|live internal domain ([f6307bb](https://github.com/adobe/helix-html-pipeline/commit/f6307bb9a3704a5020738b1664a01b5201064f5a))
|
|
14
|
+
|
|
1
15
|
# [6.24.0](https://github.com/adobe/helix-html-pipeline/compare/v6.23.0...v6.24.0) (2025-03-27)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/robots-pipe.js
CHANGED
|
@@ -54,9 +54,11 @@ const INTERNAL_DOMAINS = [
|
|
|
54
54
|
'.aem.page',
|
|
55
55
|
'.aem-fastly.page',
|
|
56
56
|
'.aem-cloudflare.page',
|
|
57
|
+
'.aem-gcp.page',
|
|
57
58
|
'.aem.live',
|
|
58
59
|
'.aem-fastly.live',
|
|
59
60
|
'.aem-cloudflare.live',
|
|
61
|
+
'.aem-gcp.live',
|
|
60
62
|
'.hlx.page',
|
|
61
63
|
'.hlx-fastly.page',
|
|
62
64
|
'.hlx-cloudflare.page',
|
package/src/steps/csp.js
CHANGED
|
@@ -111,9 +111,15 @@ function createAndApplyNonceOnAST(res, tree, metaCSP, headerCSP, headerCSPRO) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
visit(tree, (node) => {
|
|
114
|
-
if (scriptNonce
|
|
115
|
-
node.properties
|
|
116
|
-
|
|
114
|
+
if (scriptNonce) {
|
|
115
|
+
if (node.tagName === 'script' && node.properties?.nonce === 'aem') {
|
|
116
|
+
node.properties.nonce = nonce;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (node.tagName === 'link' && node.properties?.as === 'script' && node.properties?.nonce === 'aem') {
|
|
120
|
+
node.properties.nonce = nonce;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
if (styleNonce
|
|
@@ -222,14 +228,34 @@ export function contentSecurityPolicyOnCode(state, res) {
|
|
|
222
228
|
}
|
|
223
229
|
}
|
|
224
230
|
|
|
225
|
-
if (scriptNonce
|
|
226
|
-
|
|
227
|
-
|
|
231
|
+
if (scriptNonce) {
|
|
232
|
+
if (tag.tagName === 'script' && tag.attrs.find((attr) => attr.name === 'nonce' && attr.value === 'aem')) {
|
|
233
|
+
chunks.push(getRawHTML(tag).replace(/nonce="aem"/i, `nonce="${nonce}"`));
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (tag.tagName === 'link'
|
|
238
|
+
&& tag.attrs.find((attr) => attr.name === 'as' && attr.value === 'script')
|
|
239
|
+
&& tag.attrs.find((attr) => attr.name === 'nonce' && attr.value === 'aem')
|
|
240
|
+
) {
|
|
241
|
+
chunks.push(getRawHTML(tag).replace(/nonce="aem"/i, `nonce="${nonce}"`));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
228
244
|
}
|
|
229
245
|
|
|
230
|
-
if (styleNonce
|
|
231
|
-
|
|
232
|
-
|
|
246
|
+
if (styleNonce) {
|
|
247
|
+
if (tag.tagName === 'style' && tag.attrs.find((attr) => attr.name === 'nonce' && attr.value === 'aem')) {
|
|
248
|
+
chunks.push(getRawHTML(tag).replace(/nonce="aem"/i, `nonce="${nonce}"`));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (tag.tagName === 'link'
|
|
253
|
+
&& tag.attrs.find((attr) => attr.name === 'rel' && attr.value === 'stylesheet')
|
|
254
|
+
&& tag.attrs.find((attr) => attr.name === 'nonce' && attr.value === 'aem')
|
|
255
|
+
) {
|
|
256
|
+
chunks.push(getRawHTML(tag).replace(/nonce="aem"/i, `nonce="${nonce}"`));
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
233
259
|
}
|
|
234
260
|
|
|
235
261
|
chunks.push(getRawHTML(tag));
|