fix(security): repair ineffective resolutions for picomatch and ws - #13
Open
alexandre-parfin wants to merge 1 commit into
Open
fix(security): repair ineffective resolutions for picomatch and ws#13alexandre-parfin wants to merge 1 commit into
alexandre-parfin wants to merge 1 commit into
Conversation
After [#8/#10/#12] merged and shipped, the latest Trivy scan still reported 2 HIGH: - picomatch@2.3.1 under app/node_modules/micromatch/node_modules/... (CVE-2026-33671) - ws@8.11.0 under app/node_modules/engine.io-client/node_modules/... (CVE-2024-37890) Two issues fixed here. 1. yarn 1 selective resolutions only fire when their path root is a direct dependency. 'engine.io-client/ws: 8.17.1' silently no-ops because engine.io-client is reached transitively (@dynamic-labs/ethereum -> @metamask/sdk -> socket.io-client -> engine.io-client). Re-anchor on the direct dep: '@dynamic-labs/ethereum/**/ws: 8.17.1'. 2. The lockfile carried stale resolutions ('picomatch@^2.3.1: 2.3.1' and 'ws@~8.11.0: 8.11.0') that yarn install would not recompute on its own. Removed those entries so re-install picks the correct in-range latest, with the new resolutions enforcing the floor. 3. While here, scoped 'next/postcss' instead of 'next/**/postcss' for consistency with the docs (works either way; closer to the form yarn 1 actually documents). After this: - picomatch@^2.3.1 now collapses to 2.3.2 (CVE fixed at 2.3.2) - ws@~8.11.0 now collapses to 8.17.1 (CVE fixed at 8.17.1) Validated locally: yarn install clean, tsc --noEmit passes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
After #8 merged and shipped, the latest Trivy scan still reported 2 HIGH that the security PR was supposed to close:
Both came from yarn 1 resolution paths that didn't fire as intended.
Root cause
`yarn 1` selective resolutions only apply when the path root is a direct dependency. The previous resolution `engine.io-client/ws: 8.17.1` no-oped silently because `engine.io-client` is reached transitively:
```
@dynamic-labs/ethereum -> @metamask/sdk -> socket.io-client -> engine.io-client -> ws ~8.11.0
```
Same logic for `micromatch/picomatch`, except in that case the natural latest-in-range resolves to 2.3.2 anyway, so it sometimes looks like it works — but only after a lockfile reset.
The lockfile also carried frozen entries (`picomatch@^2.3.1: 2.3.1` and `ws@~8.11.0: 8.11.0`) that yarn would not recompute on a normal install.
Fix
`package.json`:
```diff
-"engine.io-client/ws": "8.17.1",
+"@dynamic-labs/ethereum/**/ws": "8.17.1",
```
`@dynamic-labs/ethereum` is in the project's direct dependencies, so the resolution glob actually fires and propagates down to the `ws` deep transitively.
`yarn.lock`:
After re-install:
Also tightened `next/**/postcss` → `next/postcss` for consistency with yarn-documented form (no behavior change here).
Validation