Add exact-pinned-intermediate regression fixture (Discussion #528 #2)#661
Add exact-pinned-intermediate regression fixture (Discussion #528 #2)#661Ayush7614 wants to merge 2 commits into
Conversation
…OWASP#2) Intermediate parent exact-pins qs@6.14.2 — expects npm install express@4.22.2, not npm update qs.
sonukapoor
left a comment
There was a problem hiding this comment.
The fixture itself is solid - this is exactly the edge case #528 item #2 describes, and the lockfile structure correctly isolates the nested vulnerable qs path. A few things to fix:
Removed test block - the multiple-versions-same-pkg test block was dropped with no explanation. That fixture is assigned to @coder-Yash886 in Discussion #528 and has a sister PR (#633) in flight - removing its test coverage here needs a clear reason. Could you either restore it or explain why it was removed?
readme.md regressions - three entries disappeared: payload, presenton, and the detailed twenty entry. These look like a rebase accident rather than intentional removals. Please restore them.
Hardcoded reason string - the recommendedParentUpgrade.reason in the test is manually authored, so it won't catch regressions if the scanner's actual output changes. Consider either deriving it from a real scanPackages() call or dropping the assertion on that field.
|
Thanks for the review, @sonukapoor — addressed in
Ready for another look. |
sonukapoor
left a comment
There was a problem hiding this comment.
The fixture structure is clean and the requirePackage version parameter improvement in the second commit is a nice touch.
Two things need to be addressed:
There's a TypeScript compile error: recommendedParentUpgrade in the test input is missing the required reason field. Every other test that uses this type includes it (e.g. the transitive-only test has reason: "Upgrade lint-staged..."). The field doesn't need to be meaningful for the assertion - just add reason: "Parent upgrade for exact-pinned qs@6.14.2 via express." or similar.
The test doesn't actually exercise the edge case it's designed to catch. The scenario where exact pinning produces a different outcome than a semver range requires a fix version that falls within ~6.14.0 but outside =6.14.2 - for example 6.14.3. With firstFixedVersion: "6.15.2", both the range fixture and the exact-pinned fixture follow the same code path so the test can't distinguish between them. Please update the fixture and fix version so the test actually catches the regression it claims to cover.
Branch is behind main - please rebase with git fetch origin && git rebase origin/main && git push --force-with-lease.
Adds
examples/exact-pinned-intermediate/for Discussion #528 fixture ** Fixture 2**.Summary
body-parser) exact-pinsqs@6.14.2in the lockfile — not a semver range like~6.14.0npm update qs(within-range lockfile refresh)expressChain
express@4.22.1→body-parser@1.20.4→qs@6.14.2"qs": "6.14.2"(exact) onbody-parser— only that version satisfies the pindeep-chain-no-fix)Verified scan output
What changed
examples/exact-pinned-intermediate/package.json+package-lock.jsonexamples/readme.md— fixture table + scan commandtests/fixture-scan.test.ts— asserts parent upgrade, notnpm update qsContrast with related fixtures
wrong-parent/pnpm-within-rangenpm update/pnpm updateon vulnerable pkgdeep-chain-no-fixexact-pinned-intermediateTest plan
node dist/index.js examples/exact-pinned-intermediate --verbose→npm install express@4.22.2, notnpm update qsexamples/readme.mdnpm test)Closes Discussion #528 item fixture 2 (
exact-pinned-intermediate).cc: @sonukapoor