Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
fix: cjs isomorphic-dompurify (#2037)
Maximilian Kaske8418afbd2b4a
diff --git a/packages/api/package.json b/packages/api/package.jsonindex 60b52cd1a..076ee8da0 100644--- a/packages/api/package.json+++ b/packages/api/package.json@@ -36,8 +36,7 @@"@unkey/api": "2.2.0","@vercel/blob": "0.23.3","date-fns": "3.6.0",- "dompurify": "3.3.3",- "jsdom": "29.0.1",+ "isomorphic-dompurify": "3.7.1","nanoid": "5.0.7","nanoid-dictionary": "5.0.0-beta.1","next": "16.1.6",@@ -48,7 +47,6 @@},"devDependencies": {"@openstatus/tsconfig": "workspace:*",- "@types/jsdom": "28.0.1","@types/react": "19.2.2","@types/react-dom": "19.2.2","bun-types": "1.0.8",diff --git a/packages/api/src/router/blob.ts b/packages/api/src/router/blob.tsindex 7737a485e..b5477510a 100644--- a/packages/api/src/router/blob.ts+++ b/packages/api/src/router/blob.ts@@ -10,26 +10,10 @@ export function isSvgFile(filename: string): boolean {return filename.toLowerCase().endsWith(".svg");}-// Cached DOMPurify instance to avoid recreating JSDOM on every call-let cachedDOMPurify: Awaited<ReturnType<typeof initDOMPurify>> | null = null;--async function initDOMPurify() {- const { JSDOM } = await import("jsdom");- const createDOMPurify = (await import("dompurify")).default;- return createDOMPurify(new JSDOM("").window);-}--async function getDOMPurify() {- if (!cachedDOMPurify) {- cachedDOMPurify = await initDOMPurify();- }- return cachedDOMPurify;-}-export async function sanitizeSvg(svgContent: string): Promise<string> {- // Lazy imports because root.ts merges edge + lambda routers,+ // Lazy import because root.ts merges edge + lambda routers,// so this module is evaluated in both runtimes — jsdom can't load on edge- const DOMPurify = await getDOMPurify();+ const { default: DOMPurify } = await import("isomorphic-dompurify");return DOMPurify.sanitize(svgContent, {USE_PROFILES: { svg: true, svgFilters: true },// DOMPurify's SVG profile strips all on* event handlers by default.diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b36546463..080309563 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1294,12 +1294,9 @@ importers:date-fns:specifier: 3.6.0version: 3.6.0- dompurify:- specifier: 3.3.3- version: 3.3.3- jsdom:- specifier: 29.0.1- version: 29.0.1(@noble/[email protected])+ isomorphic-dompurify:+ specifier: 3.7.1+ version: 3.7.1(@noble/[email protected])nanoid:specifier: 5.0.7version: 5.0.7@@ -1325,9 +1322,6 @@ importers:'@openstatus/tsconfig':specifier: workspace:*version: link:../tsconfig- '@types/jsdom':- specifier: 28.0.1- version: 28.0.1'@types/react':specifier: 19.2.2version: 19.2.2@@ -7322,9 +7316,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==}- '@types/[email protected]':- resolution: {integrity: sha512-GJq2QE4TAZ5ajSoCasn5DOFm8u1mI3tIFvM5tIq3W5U/RTB6gsHwc6Yhpl91X9VSDOUVblgXmG+2+sSvFQrdlw==}-'@types/[email protected]':resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}@@ -9518,6 +9509,10 @@ packages:resolution: {integrity: sha512-mIcis6w+JiQf3P7t7mg/35GKB4T1FQsBOtMIvuKw4YErj5RjtbhcTd5/I30fmkmGMwvI0WlzSNN+27K0QCMkAw==}engines: {node: '>=20'}+ resolution: {integrity: sha512-ChhzwwCm7k8h8ANiq1Vc7geCWeHGaAPusgXU5N4mu7Y2wChgn2JHvbUe6aH/XQOUG3+KV+GmqSq95MntW/V1ng==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24.0.0}+resolution: {integrity: sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==}@@ -11909,9 +11904,6 @@ packages:resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}- resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==}-resolution: {integrity: sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==}@@ -18127,13 +18119,6 @@ snapshots:'@types/[email protected]': {}- '@types/[email protected]':- dependencies:- '@types/node': 24.0.8- '@types/tough-cookie': 4.0.5- parse5: 7.3.0- undici-types: 7.24.6-'@types/[email protected]': {}'@types/[email protected]': {}@@ -20641,6 +20626,14 @@ snapshots:+ [email protected](@noble/[email protected]):+ dependencies:+ dompurify: 3.3.3+ jsdom: 29.0.1(@noble/[email protected])+ transitivePeerDependencies:+ - '@noble/hashes'+ - canvas+dependencies:node-fetch: 2.7.0@@ -23844,8 +23837,6 @@ snapshots:optional: true- [email protected]: {}-