Skip to content

Commit 0be72b0

Browse files
rhyslbwclaude
andcommitted
chore(deps): drop abandoned mock-browser to remove form-data@2.3.3
mock-browser (last published 2022) pulled an ancient chain mock-browser -> jsdom@9.12.0 -> request@2.88.2 -> form-data@2.3.3, the source of the form-data unsafe-random-boundary alert (GHSA-fjxv-7rqg-78g4) that the ~2.3.2 range could not relock past. - Removed the unused mock-browser devDependency from e2e and wallet. - Replaced its single real use in dapp-connector's injectGlobal test with a minimal inline window stub (injectGlobal only touches window.cardano; the test only reads window.location.hostname) and dropped the module .d.ts shim. Result: mock-browser, jsdom@9, request and form-data@2.3.3 are all removed; the only remaining form-data is the patched 4.0.6. dapp-connector tests green (44/44); full build green. Resolves #1703. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 65c6f08 commit 0be72b0

6 files changed

Lines changed: 39 additions & 503 deletions

File tree

packages/dapp-connector/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"jest-environment-jsdom": "^28.1.3",
4444
"jest-webextension-mock": "^3.7.19",
4545
"madge": "^5.0.1",
46-
"mock-browser": "^0.92.14",
4746
"npm-run-all": "^4.1.5",
4847
"ts-jest": "^28.0.7",
4948
"tsc-alias": "^1.8.10",

packages/dapp-connector/test/index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/dapp-connector/test/injectGlobal.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ import { Cip30Wallet } from '../src/WalletApi';
33
import { RemoteAuthenticator, WindowMaybeWithCardano, injectGlobal } from '../src';
44
import { api, properties, stubAuthenticator } from './testWallet';
55
import { dummyLogger as logger } from 'ts-log';
6-
import { mocks } from 'mock-browser';
6+
7+
// Minimal window stub: injectGlobal only touches `window.cardano`, and the tests
8+
// only read `window.location.hostname`. Typed loosely (as the previous mock-browser
9+
// window was) so the assertions can read `window.cardano[...]` directly.
10+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11+
const createWindow = (): any => ({ location: { hostname: 'localhost' } });
712

813
describe('injectGlobal', () => {
9-
let window: ReturnType<typeof mocks.MockBrowser>;
14+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
15+
let window: any;
1016

1117
beforeEach(() => {
12-
window = mocks.MockBrowser.createWindow();
18+
window = createWindow();
1319
});
1420

1521
it('creates the cardano scope when not exists, and injects the wallet public API into it', async () => {

packages/e2e/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@
160160
"jest-webextension-mock": "^3.7.22",
161161
"json-bigint": "^1.0.0",
162162
"madge": "^5.0.1",
163-
"mock-browser": "^0.92.14",
164163
"npm-run-all": "^4.1.5",
165164
"null-loader": "^4.0.1",
166165
"readable-stream": "^3.6.0",

packages/wallet/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"jest": "^28.1.3",
5555
"jest-webextension-mock": "^3.7.19",
5656
"madge": "^5.0.1",
57-
"mock-browser": "^0.92.14",
5857
"npm-run-all": "^4.1.5",
5958
"ts-jest": "^28.0.7",
6059
"tsc-alias": "^1.8.10",

0 commit comments

Comments
 (0)