@xexr/blog-platform 1.1.0 → 1.1.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,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4c880fb: Escape JSON-LD structured data for safe embedding in script tags.
8
+
3
9
  ## 1.1.0
4
10
 
5
11
  ### Minor Changes
@@ -99,6 +99,29 @@ describe("ArticlePage MDX security", () => {
99
99
  expect(articleBodyHtml).not.toContain("<object");
100
100
  expect(articleBodyHtml).not.toContain("<embed");
101
101
  });
102
+
103
+ it("escapes script-breaking sequences in article structured data", async () => {
104
+ const breakout = '</script><script>window.__bloggyXss = true</script>';
105
+ const html = await renderToHtml(
106
+ React.createElement(ArticlePage, {
107
+ article: {
108
+ ...article,
109
+ title: breakout,
110
+ excerpt: `Structured data payload ${breakout}`,
111
+ site: {
112
+ ...article.site,
113
+ name: `Example ${breakout}`,
114
+ description: `Site description ${breakout}`,
115
+ },
116
+ },
117
+ showShareLinks: false,
118
+ }),
119
+ );
120
+
121
+ expect(html).not.toContain(breakout);
122
+ expect(html).toContain("\\u003c/script\\u003e");
123
+ expect(html).toContain("\\u003cscript\\u003ewindow.__bloggyXss");
124
+ });
102
125
  });
103
126
 
104
127
  function extractArticleBodyHtml(html: string): string {