@adobe/aem-cli 16.9.7 → 16.10.0

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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [16.10.0](https://github.com/adobe/helix-cli/compare/v16.9.8...v16.10.0) (2025-02-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * add CSP with nonce support ([#2478](https://github.com/adobe/helix-cli/issues/2478)) ([53786dc](https://github.com/adobe/helix-cli/commit/53786dc0f184bff8392391cb392158debd7ada1f))
7
+
8
+ ## [16.9.8](https://github.com/adobe/helix-cli/compare/v16.9.7...v16.9.8) (2025-02-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency compression to v1.8.0 ([#2490](https://github.com/adobe/helix-cli/issues/2490)) ([adf0651](https://github.com/adobe/helix-cli/commit/adf0651bc839c4b87c8666af1382d636713346da))
14
+
1
15
  ## [16.9.7](https://github.com/adobe/helix-cli/compare/v16.9.6...v16.9.7) (2025-02-10)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aem-cli",
3
- "version": "16.9.7",
3
+ "version": "16.10.0",
4
4
  "description": "AEM CLI",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "camelcase": "8.0.0",
47
47
  "chalk-template": "1.1.0",
48
48
  "chokidar": "4.0.3",
49
- "compression": "1.7.5",
49
+ "compression": "1.8.0",
50
50
  "cookie": "1.0.2",
51
51
  "cookie-parser": "1.4.7",
52
52
  "dotenv": "16.4.7",
@@ -31,6 +31,12 @@ export default class HeadHtmlSupport {
31
31
  const update = (obj, keys) => {
32
32
  keys.sort();
33
33
  for (const k of keys) {
34
+ if (k === 'nonce') {
35
+ // ignore nonce attribute, because it can change on every request
36
+ // eslint-disable-next-line no-continue
37
+ continue;
38
+ }
39
+
34
40
  let v = obj[k];
35
41
  if (v !== undefined) {
36
42
  if (Array.isArray(v)) {
@@ -89,9 +89,11 @@ const utils = {
89
89
  if (match) {
90
90
  const { index } = match;
91
91
  // eslint-disable-next-line no-param-reassign
92
+ const nonceMatch = body.match(/nonce="([a-zA-Z0-9+/=]+)"/);
93
+ const nonce = nonceMatch ? ` nonce="${nonceMatch[1]}"` : '';
92
94
  let newbody = body.substring(0, index);
93
95
  if (process.env.CODESPACES === 'true') {
94
- newbody += `<script>
96
+ newbody += `<script${nonce}>
95
97
  window.LiveReloadOptions = {
96
98
  host: new URL(location.href).hostname.replace(/-[0-9]+\\.preview\\.app\\.github\\.dev/, '-35729.preview.app.github.dev'),
97
99
  port: 443,
@@ -99,9 +101,9 @@ window.LiveReloadOptions = {
99
101
  };
100
102
  </script>`;
101
103
  } else {
102
- newbody += `<script>window.LiveReloadOptions={port:${server.port},host:location.hostname,https:${server.scheme === 'https'}};</script>`;
104
+ newbody += `<script${nonce}>window.LiveReloadOptions={port:${server.port},host:location.hostname,https:${server.scheme === 'https'}};</script>`;
103
105
  }
104
- newbody += '<script src="/__internal__/livereload.js"></script>';
106
+ newbody += `<script${nonce} src="/__internal__/livereload.js"></script>`;
105
107
  newbody += body.substring(index);
106
108
  return newbody;
107
109
  }