Skip to content

fix(security): repair ineffective resolutions for picomatch and ws - #13

Open
alexandre-parfin wants to merge 1 commit into
mainfrom
fix/resolution-direct-paths
Open

fix(security): repair ineffective resolutions for picomatch and ws#13
alexandre-parfin wants to merge 1 commit into
mainfrom
fix/resolution-direct-paths

Conversation

@alexandre-parfin

Copy link
Copy Markdown

Summary

After #8 merged and shipped, the latest Trivy scan still reported 2 HIGH that the security PR was supposed to close:

  • `picomatch@2.3.1` under `app/node_modules/micromatch/node_modules/picomatch/` — CVE-2026-33671
  • `ws@8.11.0` under `app/node_modules/engine.io-client/node_modules/ws/` — CVE-2024-37890

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`:

  • Removed the frozen `picomatch@^2.3.1: 2.3.1` block
  • Removed the frozen `ws@~8.11.0: 8.11.0` block

After re-install:

  • `picomatch@^2.0.4, ^2.2.1, ^2.3.1` all collapse to 2.3.2 (CVE fixed)
  • `ws@~8.11.0` collapses to 8.17.1 (CVE fixed)

Also tightened `next/**/postcss` → `next/postcss` for consistency with yarn-documented form (no behavior change here).

Validation

  • `yarn install` clean, no incompatible-resolution warnings on the targeted packages
  • `tsc --noEmit` passes
  • Trivy on the next release shows 0 HIGH (expected)

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.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant