fix(review): correlate cross-hunk lockfile tamper signals by package (#8351)#8491
Conversation
…oss hunk boundaries Introduces a new function to recover package names from resolved URLs, allowing for better correlation of version and integrity changes across separate hunks. This change addresses issues where legitimate version bumps could be falsely flagged due to the split of entries in the lockfile. Additionally, several regression tests have been added to ensure correct behavior in various scenarios involving unattributed entries, including cases where package names are inferred from resolved URLs. This implementation aims to improve the accuracy of lockfile tamper detection and maintain the integrity of package management processes. Closes JSONbored#8351.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8491 +/- ##
==========================================
+ Coverage 79.69% 89.65% +9.95%
==========================================
Files 791 98 -693
Lines 79334 22852 -56482
Branches 23960 3916 -20044
==========================================
- Hits 63222 20487 -42735
+ Misses 13047 2187 -10860
+ Partials 3065 178 -2887
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 15:41:49 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
scanPackageLockPatchnow keys header-less (unattributed) fallback buckets by package name recovered from nearby npm-registryresolvedURLs — including unchanged context lines — so a legitimate version bump and its resolved/integrity change that land in separate hunks (split by a depth-0}) merge into one candidate instead of false-flagging.#unattributed-Nsequence is preserved; two different recoverable packages never share a bucket.(unattributed lockfile entry)so the Lockfile tamper detector can be silently evaded by placing the changed field outside the entry header's diff-context window #7778 assertions stay unchanged.Closes #8351
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
vitest+ coverage onsrc/review/lockfile-tamper.ts(100% branch). Fullnpm run test:cinot run on this Windows host (npm ciblocked by platform-only@codecov/bundle-analyzer); run the full local gate before push.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.UI Evidence
N/A — backend review-path fix only.
Notes
packageNameFromResolvedUrl, with sequence-key fallback and in-block promote/merge when a resolved URL appears after a sequence key was minted.