chore: upgrade to pnpm 11 via corepack with defense-in-depth workspace#141
Conversation
- Pin packageManager to pnpm@11.1.3 and set engines.node to ^22.13.0 - Replace pnpm/action-setup with corepack enable across all workflows - Bump test matrix from [20, 22, 24] to [22, 24, 26] - Apply agentic defense-in-depth pnpm-workspace settings: minimumReleaseAge 10080 (7 days), minimumReleaseAgeStrict, minimumReleaseAgeIgnoreMissingTime false, blockExoticSubdeps, strictDepBuilds, dangerouslyAllowAllBuilds false, trustPolicy no-downgrade - Migrate onlyBuiltDependencies to allowBuilds map - Consolidate pnpm config from package.json into pnpm-workspace.yaml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #141 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 37 37
Lines 1089 1089
Branches 222 221 -1
=========================================
Hits 1089 1089 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request updates the project's package management and security configurations by specifying Node.js and pnpm versions, strengthening pnpm workspace policies, and removing the terser dependency. Feedback suggests further improving security by adding an override for the vulnerable @ungap/structured-clone package and pruning the allowBuilds list to remove unnecessary script execution permissions for core-js, protobufjs, and unrs-resolver.
| vue-demi: true | ||
|
|
||
| overrides: | ||
| set-cookie-parser: 2.7.2 |
There was a problem hiding this comment.
The pnpm-lock.yaml file (line 1337) indicates that @ungap/structured-clone@1.3.0 is deprecated due to a potential security vulnerability (CWE-502). Since this PR is consolidating security policies and overrides, it is recommended to add an override to ensure a safe version (1.3.1 or higher) is used.
set-cookie-parser: 2.7.2
'@ungap/structured-clone': '>=1.3.1'| allowBuilds: | ||
| '@swc/core': true | ||
| core-js: true | ||
| esbuild: true | ||
| protobufjs: true | ||
| unrs-resolver: true | ||
| vue-demi: true |
There was a problem hiding this comment.
To align with the defense-in-depth strategy of minimizing script execution, consider removing unnecessary packages from the allowBuilds list:
- core-js: Its postinstall script is primarily for display messages and is not required for functionality.
- protobufjs: Version 7.x does not have a postinstall script.
- unrs-resolver: This package is no longer present in the dependency tree (
pnpm-lock.yaml).
allowBuilds:
'@swc/core': true
esbuild: true
vue-demi: trueThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d93b64edd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - run: corepack enable | ||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v5 |
There was a problem hiding this comment.
Run Corepack after selecting the job's Node version
corepack enable is executed before actions/setup-node, but Corepack installs shims next to the currently resolved corepack binary; after setup-node switches PATH to the matrix Node, that Node installation may not have the pnpm shim enabled. In this workflow, pnpm can therefore resolve to a shim from the runner’s preinstalled Node (or be missing), which can bypass the intended matrix version or fail entirely when pnpm 11 requires a newer runtime. Move corepack enable to after actions/setup-node (same issue appears in the other updated workflows).
Useful? React with 👍 / 👎.
| "types": "dist/index.d.mts", | ||
| "packageManager": "pnpm@11.1.3", | ||
| "engines": { | ||
| "node": "^22.13.0" |
There was a problem hiding this comment.
Widen Node engine range to include supported newer majors
Setting engines.node to ^22.13.0 restricts the package to <23.0.0, which excludes Node 24 and 26 even though the CI matrix explicitly tests those versions. Users with engine-strict enabled (common in CI and some org defaults) will get install failures on newer supported Node majors; use a minimum range like >=22.13.0 if newer majors are intended to be supported.
Useful? React with 👍 / 👎.
- Override @ungap/structured-clone to >=1.3.1 (1.3.0 deprecated, CWE-502) - Prune allowBuilds: drop unrs-resolver (not in tree), set core-js and protobufjs to false (postinstalls are informational/no-op) - Widen engines.node from ^22.13.0 to >=22.13.0 so it matches the Node 22/24/26 test matrix and engine-strict consumers - Move corepack enable after setup-node so shims target the matrix Node - Drop cache: 'pnpm' since setup-node's pnpm cache needs pnpm available before setup-node runs, which conflicts with the new ordering
setup-node v5 added auto package-manager-cache that detects packageManager from package.json and invokes pnpm during the setup step. Since corepack runs after setup-node, pnpm isn't on PATH yet and setup-node fails with "Unable to locate executable file: pnpm". Set package-manager-cache: false on every setup-node@v5 step to opt out of that auto-detection.
Summary
packageManagertopnpm@11.1.3and setsengines.nodeto^22.13.0(pnpm 11 requires Node >= 22.13)pnpm/action-setup@v4step withcorepack enableso the version comes frompackage.jsonrather than each workflowtests.yamlfrom[20, 22, 24]to[22, 24, 26](Node 20 dropped because pnpm 11 no longer supports it)defense-in-depth-nodejs.md§4:minimumReleaseAge: 10080(7 days, was 2880 = 2 days)minimumReleaseAgeStrict: true(fail closed instead of falling back)minimumReleaseAgeIgnoreMissingTime: false(missing publish-time fails closed)blockExoticSubdeps: truestrictDepBuilds: truedangerouslyAllowAllBuilds: falsetrustPolicy: no-downgradeonlyBuiltDependencies(array) toallowBuilds(map ofname: true) as required by pnpm 11overrides, allowed builds) out ofpackage.jsonand intopnpm-workspace.yaml, so the security policy lives in one reviewed fileTest plan
corepack enable+pnpm install --frozen-lockfilesucceeds with pnpm 11.1.3pnpm buildsucceeds (tsdown target now resolves tonode22.13.0fromengines)pnpm test:cipasses — 413 tests, 100% line coverageNotes
The lockfile changed because:
glob@<=11.1.0override is now recorded inpnpm-lock.yaml(it was inpnpm-workspace.yamlalready but the lockfile was generated before pnpm enforced it).acorn,buffer-from,@jridgewell/source-map).Sources:
Generated by Claude Code