Repository navigation
fix(security): backport lockfile & manifest name/slot containment to v10 - #12890
Conversation
Backports the TypeScript portion of 51300fd (#12872) to release/10. Two advisories: - GHSA-c59q-g84q-2gj5: lockfile depPath name -> isolated linker + PnP. - GHSA-vq4v-j7r6-jq4m: dependency manifest `name` from the fetched tarball (e.g. @x/../../../path) -> resolver/linker. Apply safeJoinModulesDir at lockfileToDepGraph (deps/graph-builder) and the PnP packageLocation (lockfile-to-pnp); validate manifest names in resolve-dependencies (extendGraph + resolvePeers); contain the global-virtual-store slot dir by rejecting a traversal version segment in iterateHashedGraphNodes (calc-dep-state), the single point every GVS slot path funnels through. The pacquet and env-installer changes from the original commit do not apply to v10 (no pacquet stack; installConfigDeps has no GVS subdep installation and config-dependency names are already validated by assertValidConfigDepName from #12504). All rejections surface ERR_PNPM_INVALID_DEPENDENCY_NAME. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by Qodofix(security): contain traversal names/slots from lockfile & manifests (v10)
AI Description
Diagram
High-Level Assessment
Files changed (19)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. Unsorted imports in lockfileToDepGraph.ts
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Backports the TypeScript portion of 51300fd (#12872) to
release/10, covering two advisories:pnpm-lock.yamlwhosepackagesdepPath key carries a path-traversal name (e.g.../../../tmp/[email protected]) could make the isolated (virtual-store) linker and the Plug'n'Play resolver map write/point outside the virtual store.nameis a scoped path traversal (e.g.@x/../../../<path>) could be written outsidenode_modulesduringpnpm install, even with--ignore-scripts.Changes (mapped from the
pnpm11/layout to v10)deps/graph-builderlockfileToDepGraphdeps/graph-builder/src/lockfileToDepGraph.ts—safeJoinModulesDirat the name joindeps/graph-hasherformatGlobalVirtualStorePathpackages/calc-dep-stateiterateHashedGraphNodes— reject a traversal version segment at the single point every global-virtual-store slot path funnels throughinstalling/deps-resolver(extendGraph,resolvePeers)pkg-manager/resolve-dependenciessrc/index.ts+src/resolvePeers.ts—safeJoinModulesDirat both name joinslockfile/to-pnplockfile/lockfile-to-pnp— contain the PnPpackageLocationNot applicable to v10: the pacquet (Rust) changes, and the env-installer/
installOptionalSubdepsguards (v10'sinstallConfigDepshas no global-virtual-store subdep installation, and config-dependency names are already validated byassertValidConfigDepNamefrom #12504).All rejections surface
ERR_PNPM_INVALID_DEPENDENCY_NAME, matching main.Tests
deps/graph-builder(new test suite: traversal/reserved names, no directory created outside the store, GVS version-segment escape).calc-dep-state(iterateHashedGraphNodes).lockfile-to-pnp.pkg-with-path-traversal-name.tgzfixture) to@pnpm/core.@pnpm/coreglobal-virtual-store install tests.🤖 Generated with Claude Code