@xexr/blog-platform 1.1.0 → 1.1.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 +6 -0
- package/dist/app/blog/[slug]/page.mdx-security.test.ts +23 -0
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/dist/lib/storage/drizzle.ts +19 -6
- package/dist/lib/structured-data.ts +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -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 {
|