From 73e360844bef0264f1cc92f04b6a6b852f55b8eb Mon Sep 17 00:00:00 2001 From: Manish Gupta <59428681+mguptahub@users.noreply.github.com> Date: Thu, 9 Jul 2026 18:30:54 +0530 Subject: [PATCH] [WEB-7888] fix(security): normalize href before protocol check in CustomLinkExtension (GHSA-v2vv-7wq3-8w2j) (#9313) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [WEB-7888] fix(security): normalize href before protocol check in CustomLinkExtension (GHSA-v2vv-7wq3-8w2j) 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 * [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 --------- Co-authored-by: Plane AI --- .../core/extensions/custom-link/extension.tsx | Bin 6737 -> 7570 bytes .../custom-link/helpers/clickHandler.ts | 10 ++++++++++ 2 files changed, 10 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