diff --git a/package.json b/package.json index ee38859..0686d9d 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "ofetch": "^1.3.3", "pathe": "^1.1.1", "sharp": "^0.32.6", - "svgo": "^3.0.2", + "svgo": "^3.0.3", "ufo": "^1.3.1", "unstorage": "^1.9.0", "xss": "^1.0.14" @@ -69,4 +69,4 @@ "vitest": "^0.34.6" }, "packageManager": "pnpm@8.10.2" -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e21877..7ff791a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,8 +42,8 @@ dependencies: specifier: ^0.32.6 version: 0.32.6 svgo: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^3.0.3 + version: 3.0.3 ufo: specifier: ^1.3.1 version: 1.3.1 @@ -4482,8 +4482,8 @@ packages: engines: {node: '>= 0.4'} dev: true - /svgo@3.0.2: - resolution: {integrity: sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==} + /svgo@3.0.3: + resolution: {integrity: sha512-X4UZvLhOglD5Xrp834HzGHf8RKUW0Ahigg/08yRO1no9t2NxffOkMiQ0WmaMIbaGlVTlSst2zWANsdhz5ybXgA==} engines: {node: '>=14.0.0'} hasBin: true dependencies: diff --git a/src/ipx.ts b/src/ipx.ts index 2e69036..b7451b0 100644 --- a/src/ipx.ts +++ b/src/ipx.ts @@ -73,8 +73,7 @@ export function createIPX(userOptions: IPXOptions): IPX { const getSVGO = cachedPromise(async () => { const { optimize } = await import("svgo"); - const { xss } = await import("./lib/svgo-xss"); - return { optimize, xss }; + return { optimize }; }); return function ipx(id, modifiers = {}, opts = {}) { @@ -176,10 +175,10 @@ export function createIPX(userOptions: IPXOptions): IPX { }; } else { // https://github.com/svg/svgo - const { optimize, xss } = await getSVGO(); + const { optimize } = await getSVGO(); const svg = optimize(sourceData.toString("utf8"), { ...options.svgo, - plugins: [xss, ...(options.svgo?.plugins || [])], + plugins: ["removeScriptElement", ...(options.svgo?.plugins || [])], }).data; return { data: svg, diff --git a/src/lib/svgo-xss.ts b/src/lib/svgo-xss.ts deleted file mode 100644 index ad35287..0000000 --- a/src/lib/svgo-xss.ts +++ /dev/null @@ -1,133 +0,0 @@ -import type { CustomPlugin } from "svgo"; - -/** - * Remove possible XSS attacks. - * - * * Remove