Skip to content

Commit c3393e8

Browse files
authored
chore(deps): fix npm package vulnerabilities in web and e2e/playwright (#5905)
* chore(deps): fix npm package vulnerabilities in web and e2e/playwright * chore(deps): update resolution versions in web/package.json * fix(web): patch ajv vulns and fix unit tests - Upgrade ajv to 8.20.0 via yarn selective resolutions and lockfile update to resolve 4 moderate ReDoS vulnerabilities. - Add mjs transform and babel plugin for private methods to support ESM-only msw dependencies (rettime, @open-draft, etc). - Add WritableStream polyfill for msw compatibility in jsdom. - Expand transformIgnorePatterns to cover msw's ESM transitive dependencies. Fixes yarn audit: 6 vulns -> 2 low (elliptic, no patch available).
1 parent 7d9c6cb commit c3393e8

7 files changed

Lines changed: 1871 additions & 2637 deletions

File tree

e2e/playwright/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/playwright/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "playwright",
2+
"name": "kots-e2e-playwright",
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",

web/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ module.exports = {
77
plugins: [
88
["@babel/plugin-transform-class-properties", { loose: true }],
99
["@babel/plugin-transform-optional-chaining", { loose: true }],
10+
["@babel/plugin-transform-private-methods", { loose: true }],
1011
],
1112
};

web/jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77

88
// Transform files with babel and ts-jest
99
transform: {
10-
'^.+\\.(js|jsx)$': 'babel-jest',
10+
'^.+\\.(js|jsx|mjs)$': 'babel-jest',
1111
'^.+\\.(ts|tsx)$': ['ts-jest', {
1212
useESM: true
1313
}],
@@ -18,7 +18,7 @@ module.exports = {
1818

1919
// Transform ignore patterns for ES modules
2020
transformIgnorePatterns: [
21-
'node_modules/(?!(query-string|intersection-observer|@tanstack|msw|decode-uri-component|filter-obj|split-on-first|until-async)/)'
21+
'node_modules/(?!(query-string|intersection-observer|@tanstack|msw|@mswjs|@open-draft|decode-uri-component|filter-obj|split-on-first|until-async|rettime|outvariant|strict-event-emitter|headers-polyfill|is-node-process)/)'
2222
],
2323

2424
// Module name mapping for imports

web/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,16 @@
139139
"not dead"
140140
],
141141
"resolutions": {
142-
"qs": "^6.14.2",
142+
"qs": "^6.15.1",
143143
"**/glob": "^10.5.0",
144-
"**/react-router": "^7.12.0",
144+
"**/react-router": "^7.15.0",
145145
"**/js-yaml": "^4.1.1",
146146
"dompurify": "^3.4.2",
147147
"serialize-javascript": "^7.0.5",
148148
"lodash": "^4.18.1",
149-
"minimatch": "^3.1.4",
150-
"picomatch": "^2.3.2"
149+
"minimatch": "^3.1.5",
150+
"picomatch": "^2.3.2",
151+
"schema-utils/ajv": "^8.20.0",
152+
"ajv-formats/ajv": "^8.20.0"
151153
}
152154
}

web/src/jest-setup.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import "intersection-observer";
22
import "@testing-library/jest-dom";
3+
import { WritableStream } from "node:stream/web";
4+
5+
// Polyfill WritableStream for MSW compatibility in JSDOM
6+
// jest-fixed-jsdom provides ReadableStream but not WritableStream
7+
// @ts-ignore
8+
if (typeof globalThis.WritableStream === "undefined") {
9+
// @ts-ignore
10+
globalThis.WritableStream = WritableStream;
11+
}
312

413
// Set default API endpoint for tests to prevent undefined URLs
514
process.env.API_ENDPOINT = process.env.API_ENDPOINT || "http://test-api";

0 commit comments

Comments
 (0)