@adobe/helix-html-pipeline 6.13.0 → 6.14.1

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
+ ## [6.14.1](https://github.com/adobe/helix-html-pipeline/compare/v6.14.0...v6.14.1) (2024-08-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * escape HTML characters in JSON LD ([8595baa](https://github.com/adobe/helix-html-pipeline/commit/8595baa751433be0e9194110890a7bdb689a710c))
7
+
8
+ # [6.14.0](https://github.com/adobe/helix-html-pipeline/compare/v6.13.0...v6.14.0) (2024-08-01)
9
+
10
+
11
+ ### Features
12
+
13
+ * make json-ld metadata more robust ([#658](https://github.com/adobe/helix-html-pipeline/issues/658)) ([3d3e5dc](https://github.com/adobe/helix-html-pipeline/commit/3d3e5dc5e39a601a5f9b225d6409f2cfbdefc138))
14
+
1
15
  # [6.13.0](https://github.com/adobe/helix-html-pipeline/compare/v6.12.10...v6.13.0) (2024-07-30)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.13.0",
3
+ "version": "6.14.1",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "lint": "eslint .",
18
18
  "semantic-release": "semantic-release",
19
19
  "semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH",
20
- "prepare": "husky install"
20
+ "prepare": "husky"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -81,12 +81,12 @@
81
81
  "eslint-plugin-header": "3.1.1",
82
82
  "eslint-plugin-import": "2.29.1",
83
83
  "esmock": "2.6.7",
84
- "husky": "9.1.3",
84
+ "husky": "9.1.4",
85
85
  "js-yaml": "4.1.0",
86
86
  "jsdom": "24.1.1",
87
- "junit-report-builder": "4.0.0",
88
- "lint-staged": "15.2.7",
89
- "mocha": "10.7.0",
87
+ "junit-report-builder": "4.0.1",
88
+ "lint-staged": "15.2.8",
89
+ "mocha": "10.7.3",
90
90
  "mocha-multi-reporters": "1.5.1",
91
91
  "mocha-suppress-logs": "0.5.1",
92
92
  "semantic-release": "24.0.0"
@@ -43,6 +43,12 @@ function readBlockConfig($block) {
43
43
  const [$name, $value] = $row.children;
44
44
  const name = toMetaName(toString($name));
45
45
  if (name) {
46
+ // special case for json-ld. don't apply any special formatting
47
+ if (name.toLowerCase() === 'json-ld') {
48
+ config[name] = toString($value).trim();
49
+ return;
50
+ }
51
+
46
52
  let value;
47
53
  const $firstChild = childNodes($value)[0];
48
54
  if ($firstChild) {
@@ -36,10 +36,8 @@ function createElement(name, ...attrs) {
36
36
  }
37
37
 
38
38
  function sanitizeJsonLd(jsonLd) {
39
- if (jsonLd.toLowerCase().indexOf('</script>') >= 0) {
40
- throw new Error('script tag not allowed');
41
- }
42
- return JSON.stringify(JSON.parse(jsonLd.trim()));
39
+ const sanitizedJsonLd = jsonLd.replaceAll('<', '&#x3c;').replaceAll('>', '&#x3e;');
40
+ return JSON.stringify(JSON.parse(sanitizedJsonLd.trim()));
43
41
  }
44
42
 
45
43
  /**