Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(deps): patch dompurify

justin31cf3cce70a6
diff --git a/apps/web/package.json b/apps/web/package.json
index ecb7aecac..fdbc64e58 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -75,7 +75,7 @@
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"date-fns": "^4.4.0",
- "dompurify": "^3.4.16",
+ "dompurify": "^3.4.17",
"file-saver": "^2.0.5",
"framer-motion": "^13.4.6",
"highlight.js": "^11.12.0",
diff --git a/apps/web/src/lib/dompurify.test.ts b/apps/web/src/lib/dompurify.test.ts
new file mode 100644
index 000000000..f10814e32
--- /dev/null
+++ b/apps/web/src/lib/dompurify.test.ts
@@ -0,0 +1,41 @@
+import DOMPurify from "dompurify";
+import { describe, expect, it } from "vite-plus/test";
+
+describe("DOMPurify security regressions", () => {
+ it("scrubs split template expressions inside attached shadow roots", () => {
+ const host = document.createElement("div");
+ const root = host.attachShadow({ mode: "open" });
+
+ // GHSA-cg2g-xh64-v4q7 joins these fragments when it removes the object.
+ root.append(
+ document.createTextNode("$"),
+ document.createElement("object"),
+ document.createTextNode("{alert(document.domain)}"),
+ );
+
+ DOMPurify.sanitize(host, { IN_PLACE: true, SAFE_FOR_TEMPLATES: true });
+ root.normalize();
+
+ expect(root.querySelector("object")).toBeNull();
+ expect(root.textContent).not.toContain(`\${alert(document.domain)}`);
+ });
+
+ it("preserves diagram SVG while stripping executable content", () => {
+ const svg = DOMPurify.sanitize(
+ '<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)">' +
+ "<script>alert(1)</script>" +
+ '<circle cx="10" cy="10" r="5" onclick="alert(1)" />' +
+ '<a href="javascript:alert(1)"><text>Diagram</text></a>' +
+ "</svg>",
+ { USE_PROFILES: { svg: true, svgFilters: true } },
+ );
+ const container = document.createElement("div");
+ container.innerHTML = svg;
+
+ expect(container.querySelector("svg")).not.toBeNull();
+ expect(container.querySelector("circle")?.getAttribute("r")).toBe("5");
+ expect(container.querySelector("text")?.textContent).toBe("Diagram");
+ expect(container.querySelector("script, [onload], [onclick]")).toBeNull();
+ expect(container.querySelector("a")?.hasAttribute("href")).toBe(false);
+ });
+});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c6d42f96d..74701215f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -24,6 +24,7 @@ overrides:
'@hono/node-server': '>=1.19.13'
ajv: 8.18.0
diff: 8.0.3
+ dompurify: ^3.4.17
esbuild: 0.28.1
express-rate-limit: 8.2.2
hono: '>=4.13.5'
@@ -626,8 +627,8 @@ importers:
specifier: ^4.4.0
version: 4.4.0
dompurify:
- specifier: ^3.4.16
- version: 3.4.16
+ specifier: ^3.4.17
+ version: 3.4.17
file-saver:
specifier: ^2.0.5
version: 2.0.5
@@ -7433,8 +7434,8 @@ packages:
resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
engines: {node: '>= 4'}
- resolution: {integrity: sha512-sqo+pNp3qRhCIpbgRi1y8Tgk27Bo2Ry7w0dC1NBeNTdZChWjz9Xb/KOoZbRP/R6pQZ80Qw8YhXw13hWWBbMRnQ==}
+ resolution: {integrity: sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==}
resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}
@@ -18602,7 +18603,7 @@ snapshots:
dependencies:
domelementtype: 2.3.0
optionalDependencies:
'@types/trusted-types': 2.0.7
@@ -20315,7 +20316,7 @@ snapshots:
d3-sankey: 0.12.3
dagre-d3-es: 7.0.14
dayjs: 1.11.21
- dompurify: 3.4.16
+ dompurify: 3.4.17
es-toolkit: 1.50.0
katex: 0.16.47
khroma: 2.1.0
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index b9e8945ae..d667cdbd2 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -6,6 +6,7 @@ overrides:
"@hono/node-server": ">=1.19.13"
ajv: 8.18.0
diff: 8.0.3
+ dompurify: ^3.4.17
esbuild: 0.28.1
express-rate-limit: 8.2.2
hono: ">=4.13.5"