The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
fix(deps): bump sanitize-html to 2.17.7 (#1625)
Viktor Holik8520f5b533e9
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.ymlindex 2e08060f8..c52a1e8de 100644--- a/.github/workflows/integration-tests.yml+++ b/.github/workflows/integration-tests.yml@@ -40,7 +40,7 @@ jobs:- name: Setup Node.jsuses: actions/setup-node@v7with:- node-version: 20+ node-version: 24- name: Cache Bun dependenciesuses: actions/cache@v6@@ -156,7 +156,7 @@ jobs:- name: Setup Node.jsuses: actions/setup-node@v7with:- node-version: 20+ node-version: 24- name: Cache Bun dependenciesuses: actions/cache@v6diff --git a/apps/storefront/package.json b/apps/storefront/package.jsonindex 134708708..de8c427cc 100644--- a/apps/storefront/package.json+++ b/apps/storefront/package.json@@ -34,7 +34,7 @@"react-dom": "^19.0.0","react-hook-form": "^7.88.0","react-i18next": "^17.0.14",- "sanitize-html": "2.17.5",+ "sanitize-html": "2.17.7","sonner": "^2.0.7","tailwind-merge": "^2.6.0","talkjs": "^0.37.0",diff --git a/bun.lock b/bun.lockindex bd113a2ee..992cde7d5 100644--- a/bun.lock+++ b/bun.lock@@ -117,7 +117,7 @@"react-dom": "^19.0.0","react-hook-form": "^7.88.0","react-i18next": "^17.0.14",- "sanitize-html": "2.17.5",+ "sanitize-html": "2.17.7","sonner": "^2.0.7","tailwind-merge": "^2.6.0","talkjs": "^0.37.0",@@ -402,7 +402,7 @@"@orama/orama": "^3.1.18","pkg-dir": "4","resolve-cwd": "^3.0.0",- "sanitize-html": "2.17.5",+ "sanitize-html": "2.17.7","zod": "4.6.5",},"devDependencies": {@@ -4295,7 +4295,7 @@"safer-buffer": ["[email protected]", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],- "sanitize-html": ["[email protected]", "", { "dependencies": { "deepmerge": "^4.2.2", "escape-string-regexp": "^4.0.0", "htmlparser2": "^10.1.0", "is-plain-object": "^5.0.0", "launder": "^1.7.1", "parse-srcset": "^1.0.2", "postcss": "^8.3.11" } }, "sha512-ZmU1joGRrvoyctKIiuwUxqR6moLoU2Wk+2bMccN6f7UwhAmwYDvWziqPxRDDN2Qip62NqnIrVrT9akbL6Wretg=="],+ "sanitize-html": ["[email protected]", "", { "dependencies": { "deepmerge": "^4.2.2", "escape-string-regexp": "^4.0.0", "htmlparser2": "^12.0.0", "is-plain-object": "^5.0.0", "launder": "^1.7.1", "parse-srcset": "^1.0.2", "postcss": "^8.3.11" } }, "sha512-PGtEkc9cbnedU3s9TmzDbpsZ8w086g/0Q8k8/oIO1NLNU3i5k9yn835CrjJSajp1KMmkisbO1qPXxNKO3welAg=="],"sass-loader": ["[email protected]", "", { "dependencies": { "neo-async": "^2.6.2" }, "peerDependencies": { "@rspack/core": "0.x || 1.x", "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", "sass": "^1.3.0", "sass-embedded": "*", "webpack": "^5.0.0" }, "optionalPeers": ["@rspack/core", "node-sass", "sass", "sass-embedded", "webpack"] }, "sha512-G0VcnMYU18a4N7VoNDegg2OuMjYtxnqzQWARVWCIVSZwJeiL9kg8QMsuIZOplsJgTzZLF6jGxI3AClj8I9nRdQ=="],@@ -5815,6 +5815,8 @@"safe-push-apply/isarray": ["[email protected]", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],+ "sanitize-html/htmlparser2": ["[email protected]", "", { "dependencies": { "domelementtype": "^3.0.0", "domhandler": "^6.0.0", "domutils": "^4.0.2", "entities": "^8.0.0" } }, "sha512-Tz7u1i95/g2x2jz81+x0FBVhBhY5aRTvD3tXXdFaljuNdzDLJ8UGNRrTcj2cgQvAg3iW/h77Fz15nLW0L0CrZw=="],+"schema-utils/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.4.1" } }, "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA=="],"send/debug": ["[email protected]", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],@@ -6763,6 +6765,14 @@"ripemd160/hash-base/readable-stream": ["[email protected]", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],+ "sanitize-html/htmlparser2/domelementtype": ["[email protected]", "", {}, "sha512-umCQid3jKbDmVjx8jGaW7uUykm4DEUeyV21hPxNMo2nV955DhUThwqyOIDtreepP31hl84X7G5U9ZfsWvIB3Pg=="],++ "sanitize-html/htmlparser2/domhandler": ["[email protected]", "", { "dependencies": { "domelementtype": "^3.0.0" } }, "sha512-gYzvtM72ZtxQO0T048kd6HWSbbGCNOUwcnfQ01cqIJ4X2IYKFFHZ5mKvrQETcFXxsRObZulDaKmy//R7TPtsBg=="],++ "sanitize-html/htmlparser2/domutils": ["[email protected]", "", { "dependencies": { "dom-serializer": "^3.0.0", "domelementtype": "^3.0.0", "domhandler": "^6.0.0" } }, "sha512-qI4JLRKnSzqFqr7hAlS5xQDusBCjKSEG4t4+7aNrIQMHBcsC2TGEhuyABJdYkgSewL57PNLYEiibY2iPKhKpaA=="],++ "sanitize-html/htmlparser2/entities": ["[email protected]", "", {}, "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA=="],+"schema-utils/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],"send/debug/ms": ["[email protected]", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],@@ -7269,6 +7279,8 @@"ripemd160/hash-base/readable-stream/string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],+ "sanitize-html/htmlparser2/domutils/dom-serializer": ["[email protected]", "", { "dependencies": { "domelementtype": "^3.0.0", "domhandler": "^6.0.0", "entities": "^8.0.0" } }, "sha512-4MEa38/QexBob6gFNwu+EGdWvhJ1OKuNwdYY3Y3NyeWDQfnGeDYQUDfIRzWu5B5gsv03so2Uxd28YC6zrsx3Lw=="],+"tailwindcss/chokidar/readdirp/picomatch": ["[email protected]", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],"test-exclude/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],diff --git a/integration-tests/jest.config.js b/integration-tests/jest.config.jsindex 7d28f00d0..8f30db200 100644--- a/integration-tests/jest.config.js+++ b/integration-tests/jest.config.js@@ -22,9 +22,10 @@ module.exports = {},testEnvironment: "node",// Everything in node_modules is left untransformed except the core-flows cart,- // order and payment files the patches target.+ // order and payment files the patches target, and the ESM-only htmlparser2+ // chain that sanitize-html require()s (Jest can't load ESM through require).transformIgnorePatterns: [- "/node_modules/(?!.*core-flows[\\\\/]dist[\\\\/](cart|order|payment)[\\\\/])",+ "/node_modules/(?!.*core-flows[\\\\/]dist[\\\\/](cart|order|payment)[\\\\/]|(?:.*[\\\\/])?(htmlparser2|domhandler|domutils|domelementtype|dom-serializer|entities)[\\\\/]dist[\\\\/])",],moduleFileExtensions: ["js", "ts", "json"],modulePathIgnorePatterns: ["dist/"],diff --git a/packages/core/package.json b/packages/core/package.jsonindex 4e27af6a7..edc1fc213 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -99,7 +99,7 @@"@orama/orama": "^3.1.18","pkg-dir": "4","resolve-cwd": "^3.0.0",- "sanitize-html": "2.17.5",+ "sanitize-html": "2.17.7","zod": "4.6.5"}}diff --git a/packages/core/src/utils/__tests__/sanitize-rich-text.unit.spec.ts b/packages/core/src/utils/__tests__/sanitize-rich-text.unit.spec.tsindex ed3f11fad..caa8301dc 100644--- a/packages/core/src/utils/__tests__/sanitize-rich-text.unit.spec.ts+++ b/packages/core/src/utils/__tests__/sanitize-rich-text.unit.spec.ts@@ -19,6 +19,19 @@ describe("sanitizeRichText", () => {).toBe('<p>ok</p><a rel="noopener noreferrer nofollow" target="_blank">x</a>')})+ it("neutralizes textarea mis-close and SVG animation payloads", () => {+ expect(+ sanitizeRichText(+ "<textarea></textarea/><img src=x onerror=alert(1)></textarea>"+ )+ ).toBe('<img src="x" />')+ expect(+ sanitizeRichText(+ '<svg><a><animate attributeName="href" values="#a;javascript:alert(1)"/><text>x</text></a></svg>'+ )+ ).toBe('<a rel="noopener noreferrer nofollow" target="_blank">x</a>')+ })+it("forces safe link attributes", () => {expect(sanitizeRichText('<a href="https://example.com" target="_self">x</a>')).toBe('<a href="https://example.com" target="_blank" rel="noopener noreferrer nofollow">x</a>'