From 3387e24aaae919dbcfcbc2ad8ed0a16065e1559c Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Thu, 25 Jun 2026 12:26:24 +0530 Subject: [PATCH 1/2] [WEB-7888] fix(security): normalize href before protocol check in CustomLinkExtension (GHSA-v2vv-7wq3-8w2j) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing startsWith("javascript:") guard in parseHTML() and renderHTML() is bypassable with a whitespace prefix (e.g. "\tjavascript:alert(1)"). Per the WHATWG URL spec, browsers strip ASCII Tab/LF/CR from URL strings during parsing, so the whitespace-prefixed href passes the guard, is rendered into the DOM verbatim, and executes when clicked (browser strips the tab → javascript: fires). Add isDangerousHref() helper that strips Tab/LF/CR and leading C0 controls before the protocol check, replicating the browser's normalization. Replace both naive startsWith checks in parseHTML() and renderHTML() with this helper. Add a defence-in-depth guard in clickHandler.ts that rejects javascript:/data:/vbscript: hrefs before window.open() — link.href is the browser-resolved URL (whitespace already stripped), so a regex check there catches any URI that bypasses the parse/render-time guards. Co-authored-by: Plane AI --- .../core/extensions/custom-link/extension.tsx | Bin 6737 -> 7570 bytes .../custom-link/helpers/clickHandler.ts | 9 +++++++++ 2 files changed, 9 insertions(+) diff --git a/packages/editor/src/core/extensions/custom-link/extension.tsx b/packages/editor/src/core/extensions/custom-link/extension.tsx index a00585b88489005d2a452a34055148c67f84ef7e..0b1022642581b6da5070603cff1b2904d44e3799 100644 GIT binary patch delta 1089 zcmZ{j!EVz)5Qe!RA)gAWkT@~Q1-otRP(VPUBBd#9sv1(Isd8uvSv!-&t+Q)(H*pI^ z;SG=|yZ|o%QlErZ;6-58P12}>lh?C5|IU8@%&*5^NgLOAGhL zZJ=;?43RRKRvfNS{;q@Pt$jg^3T%MqfFGZ zxYIZb`TH$(xa>_- z$5YukH)m!p&oRFg(!v)h$_i6xJ0*(Atf~JqB(4$zwC(9IIaJJz3@=df^h@j6{IE9ajVzE$jM5B+d6P|M$}A!U`EaU Mm(InH+uv{f1>A*bzyJUM delta 271 zcmbPaebHot2-oJ1ynk8w?Db0Wee%mwi<}dSQ#B^P6&8=oC`wJ!D=tYaDk%=nEXmMN z%1SItEKV-UEGV&3(p0FaQNU1 Date: Thu, 25 Jun 2026 13:14:08 +0530 Subject: [PATCH 2/2] [WEB-7888] fix: align clickHandler blocked-scheme list with isValidHttpUrl policy Add file: and about: to the clickHandler protocol guard to match the blocked-scheme contract in isValidHttpUrl, avoiding policy drift. Co-authored-by: Plane AI --- .../core/extensions/custom-link/helpers/clickHandler.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/core/extensions/custom-link/helpers/clickHandler.ts b/packages/editor/src/core/extensions/custom-link/helpers/clickHandler.ts index 63c0c406890..98c795cea3d 100644 --- a/packages/editor/src/core/extensions/custom-link/helpers/clickHandler.ts +++ b/packages/editor/src/core/extensions/custom-link/helpers/clickHandler.ts @@ -42,10 +42,11 @@ export function clickHandler(options: ClickHandlerOptions): Plugin { if (link && href) { // Defence-in-depth: link.href is the browser-resolved URL (whitespace // already stripped by the browser's WHATWG URL parser), so a protocol - // check here is sufficient to catch any javascript:/data:/vbscript: URI - // that slipped past the editor's parse/render-time guards - // (GHSA-v2vv-7wq3-8w2j). - if (/^(javascript|data|vbscript):/i.test(href)) { + // check here is sufficient to catch any dangerous URI that slipped past + // the editor's parse/render-time guards. Matches the blocked-scheme list + // in isValidHttpUrl (javascript:, data:, vbscript:, file:, about:) + // to keep the policy consistent (GHSA-v2vv-7wq3-8w2j). + if (/^(javascript|data|vbscript|file|about):/i.test(href)) { return false; }