From 262473b01b16a26f2ec4dbe92782d8bf3db36cdf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 6 Sep 2026 21:55:43 +0000 Subject: [PATCH] Fix CodeQL incomplete-sanitization in table serialization Co-authored-by: mroxso <24775431+mroxso@users.noreply.github.com> --- src/lib/documents/editor.integration.test.tsx | 14 ++++--------- src/lib/documents/markdown.test.ts | 21 +++++++++++++++++++ src/lib/documents/markdown.ts | 20 ++++++++++++------ 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/lib/documents/editor.integration.test.tsx b/src/lib/documents/editor.integration.test.tsx index 89929e7..28607b3 100644 --- a/src/lib/documents/editor.integration.test.tsx +++ b/src/lib/documents/editor.integration.test.tsx @@ -31,9 +31,7 @@ function createEditor(): Editor { describe('editor schema + sanitizer', () => { it('rejects javascript: link hrefs end to end', () => { const editor = createEditor(); - editor.commands.setContent('
', { - contentType: 'html', - }); + editor.commands.setContent(''); // The unsafe href must not survive into the document. expect(editor.getHTML()).not.toContain('javascript:'); editor.destroy(); @@ -41,9 +39,7 @@ describe('editor schema + sanitizer', () => { it('keeps safe link hrefs', () => { const editor = createEditor(); - editor.commands.setContent('', { - contentType: 'html', - }); + editor.commands.setContent(''); expect(editor.getHTML()).toContain('https://example.com'); editor.destroy(); }); @@ -51,7 +47,7 @@ describe('editor schema + sanitizer', () => { it('drops script content pasted as HTML', () => { const editor = createEditor(); const sanitized = sanitizeHtml('hello
'); - editor.commands.setContent(sanitized, { contentType: 'html' }); + editor.commands.setContent(sanitized); expect(editor.getText()).toContain('hello'); expect(editor.getHTML()).not.toContain('