diff --git a/apps/server/src/workspaces/logo.test.ts b/apps/server/src/workspaces/logo.test.ts index 1eab123..0f1fb0b 100644 --- a/apps/server/src/workspaces/logo.test.ts +++ b/apps/server/src/workspaces/logo.test.ts @@ -22,6 +22,62 @@ describe("sanitizeSvg", () => { const out = sanitizeSvg(Buffer.from(dirty)).toString("utf8"); expect(out).not.toMatch(/foreignObject/i); }); + + // Vectors the earlier regex-based sanitizer let through. The parser-based implementation + // blocks all of them; these cases exist so a "simplification" back to regexes fails CI + // rather than silently reopening the holes. + describe("vectors that defeat naive regex stripping", () => { + it("strips an unquoted javascript: href", () => { + const out = sanitizeSvg(Buffer.from(``)).toString("utf8"); + expect(out).not.toMatch(/javascript:/i); + expect(out).toContain("