diff --git a/src/core/components/providers/markdown.jsx b/src/core/components/providers/markdown.jsx index 51ba1c1b7c6..4da26ef0af7 100644 --- a/src/core/components/providers/markdown.jsx +++ b/src/core/components/providers/markdown.jsx @@ -68,7 +68,7 @@ export function sanitizer(str, { useUnsafeMarkdown = false } = {}) { return DomPurify.sanitize(str, { ADD_ATTR: ["target"], - FORBID_TAGS: ["style"], + FORBID_TAGS: ["style", "form"], ALLOW_DATA_ATTR, FORBID_ATTR, }) diff --git a/test/unit/xss/markdown-script-sanitization.jsx b/test/unit/xss/markdown-script-sanitization.jsx index 72a96414b58..3218dc3224e 100644 --- a/test/unit/xss/markdown-script-sanitization.jsx +++ b/test/unit/xss/markdown-script-sanitization.jsx @@ -16,6 +16,12 @@ describe("Markdown Script Sanitization", function() { const el = render() expect(el.html()).toEqual(`

\n
`) }) + + it("sanitizes
elements", function() { + const str = `""` + const el = render() + expect(el.html()).toEqual(`

"

"

\n
`) + }) }) describe("OAS 3", function() { @@ -30,5 +36,11 @@ describe("Markdown Script Sanitization", function() { const el = render() expect(el.html()).toEqual(`

`) }) + + it("sanitizes elements", function () { + const str = `""` + const el = render() + expect(el.html()).toEqual(`

"

"

`) + }) }) })