Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesUnresolvable lockfile audit entries
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant lockfileToAuditRequest
participant auditSignatures
participant sortIssue
lockfileToAuditRequest->>auditSignatures: return unresolvable dependency references
auditSignatures->>sortIssue: sort invalid signature issues
sortIssue-->>auditSignatures: return ordered issues
auditSignatures-->>auditSignatures: count and render unresolved references as invalid
Possibly related issues
Suggested labels: Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change is localized to reporting unresolvable lockfile entries and includes accompanying tests; no actionable merge-blocking risk remains beyond normal checks and review. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Confidence Score: 4/5The PR does not appear safe to merge until pacquet reports dangling lockfile references consistently with the TypeScript CLI. Pacquet still constructs its signature-verification list solely from resolved audit entries, so a mixed valid/dangling lockfile can omit the dangling reference and produce a clean result while the TypeScript CLI reports an invalid audit. Files Needing Attention: pnpm/crates/cli/src/cli_args/audit/request.rs, pnpm/crates/cli/src/cli_args/audit.rs Reviews (6): Last reviewed commit: "fix(audit): follow the AuditOptions regi..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (1)
pnpm11/deps/compliance/audit/src/lockfileToAuditIndex.ts (1)
71-76: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDeduplicate unresolved paths across the main and env lockfile walks.
recordUnresolvable()appends duplicates when both lockfiles reference the same missingDepPath, because eachlockfileWalkerGroupImporterSteps()call keeps its ownwalkedset. IfpackageManagerDependenciesin both lockfiles reference the same unresolvedpkg/1.0.0,auditSignatures()can add duplicate entries toinvalidand incrementauditedtwice. Track unresolvedDepPaths in oneMaporSetbefore returningunresolvable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm11/deps/compliance/audit/src/lockfileToAuditIndex.ts` around lines 71 - 76, Update recordUnresolvable to deduplicate unresolved DepPath values across all lockfile walks by tracking each path in a shared Set or Map before adding to unresolvable. Ensure repeated references to the same DepPath produce only one entry, so auditSignatures does not count or report it twice.Sources: Path instructions, MCP tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/audit-signatures-unresolvable-lockfile-entries.md:
- Around line 2-4: Update the changeset entries for `@pnpm/deps.compliance.audit`
and `@pnpm/deps.security.signatures` from patch to minor to reflect their additive
public APIs, while leaving `@pnpm/deps.compliance.commands` as patch.
In `@pnpm11/deps/compliance/audit/src/lockfileToAuditIndex.ts`:
- Around line 29-35: The regular audit() request path must also handle
auditRequest.unresolvable instead of sending only auditRequest.request and
omitting these failures. Update audit() to surface unresolved lockfile entries
consistently with auditSignatures(), or remove unresolvable from the shared
public contract if it is intentionally exclusive to signature auditing; preserve
the existing links behavior.
In `@pnpm11/deps/compliance/audit/test/index.ts`:
- Around line 34-56: Extend the compliance audit tests around
lockfileToAuditRequest() with a nested nextStep.missing case, verifying
unresolved entries are reported and counted. Add command-level coverage for
auditSignatures() that checks audited aggregation, sorted invalid results, and
exit code 1, including a lockfile containing only unresolved entries.
In `@pnpm11/deps/compliance/commands/src/audit/signatures.ts`:
- Around line 41-46: Move the auditRequest.unresolvable handling before the
empty-packages guard in the audit flow, so unresolved-only lockfiles are
reported as invalid issues and contribute to audited instead of triggering
AUDIT_NO_PACKAGES. Preserve the existing behavior for requests with no packages
and for resolvable references.
- Around line 47-51: The unresolvable-issue mapping must escape raw lockfile
values before they reach renderSignatureVerificationResult(). Update the mapping
around unresolvableIssues and apply terminal-safe encoding such as
JSON.stringify to depPath and name wherever they populate the rendered name or
reason, while preserving the underlying audit data and registry lookup behavior.
- Around line 41-55: Update the Rust signature-audit flow in `auditSignatures`
to mirror the TypeScript handling of `auditRequest.unresolvable`: create invalid
signature issues with the package name, selected registry, empty version, and
lockfile-missing-entry reason, increment `audited`, append them to `invalid`,
sort with the existing issue ordering, and preserve the nonzero exit behavior.
If this parity cannot be implemented, explicitly document it as deferred pacquet
parity in the changeset.
---
Nitpick comments:
In `@pnpm11/deps/compliance/audit/src/lockfileToAuditIndex.ts`:
- Around line 71-76: Update recordUnresolvable to deduplicate unresolved DepPath
values across all lockfile walks by tracking each path in a shared Set or Map
before adding to unresolvable. Ensure repeated references to the same DepPath
produce only one entry, so auditSignatures does not count or report it twice.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c10f5093-72bf-42c2-93ca-e5c02b5f01ed
📒 Files selected for processing (5)
.changeset/audit-signatures-unresolvable-lockfile-entries.mdpnpm11/deps/compliance/audit/src/lockfileToAuditIndex.tspnpm11/deps/compliance/audit/test/index.tspnpm11/deps/compliance/commands/src/audit/signatures.tspnpm11/deps/security/signatures/src/verifySignatures.ts
Applies the review feedback on pnpm#13733: - De-duplicate unresolvable depPaths across the main and env lockfile walks, so a reference broken in both is reported and counted once. - Stop throwing AUDIT_NO_PACKAGES when the lockfile's references are all unresolvable: that is a finding to report (exit 1), not an empty install. verifySignatures handles the empty package list without any network access, so the unresolvable-only path still works offline. - Strip control characters from lockfile/registry-sourced strings (name, version, registry, reason) before rendering the signature tables, so a forged entry cannot inject terminal escapes or break the table layout. - Document on AuditIndexRequest.unresolvable why the bulk vulnerability audit intentionally does not consume it: its output is the registry's advisory report, which has no slot for lockfile-integrity failures, and inventing one would break --json consumers. Signature auditing is where those belong. - Bump `@pnpm/deps.compliance.audit` and `@pnpm/deps.security.signatures` to minor: the new AuditIndexRequest field and the sortIssue export are additive public API. - Extend tests: nested (below-importer) unresolvable references, cross-lockfile de-duplication, and two command-level cases covering aggregation into audited/invalid, sorting, exit code 1, and the unresolvable-only lockfile that previously died on AUDIT_NO_PACKAGES. Written by an agent (Claude Code, claude-sonnet-5).
|
Ping on this one - the review rounds are done (CodeRabbit's points are all addressed and greptile signed off after the Rust-parity question was answered in the changeset). It's waiting on a maintainer read whenever there's bandwidth. |
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
@coderabbitai full review All six points from the first pass are addressed and the threads are resolved with the details. The last one — asserting that |
lockfileToAuditRequest walks the lockfile via lockfileWalkerGroupImporterSteps, whose LockfileWalkerStep already separates dependencies it resolved to a packages:/snapshots: entry from ones it couldn't (step.missing) -- but the visitor only ever read .dependencies, so a dangling reference (e.g. an importer still citing [email protected] after packages: was edited to only contain [email protected]) was silently dropped instead of counted or reported. auditSignatures builds its package list directly from lockfileToAuditRequest's output, so those entries never reached verifySignatures either: the audited/verified counts shrank, missing and invalid stayed empty, and the command exited 0 against a lockfile it could not actually audit. Collect step.missing at every level of the walk into a new unresolvable field on AuditIndexRequest, and have auditSignatures report each one as an invalid signature issue (there is no registry lookup to attempt for a reference the lockfile itself can't stand behind), folding it into `audited` so the denominator isn't quietly smaller than the lockfile actually claims. Closes pnpm#13638 Written by an agent (Claude Code, claude-sonnet-5).
Applies the review feedback on pnpm#13733: - De-duplicate unresolvable depPaths across the main and env lockfile walks, so a reference broken in both is reported and counted once. - Stop throwing AUDIT_NO_PACKAGES when the lockfile's references are all unresolvable: that is a finding to report (exit 1), not an empty install. verifySignatures handles the empty package list without any network access, so the unresolvable-only path still works offline. - Strip control characters from lockfile/registry-sourced strings (name, version, registry, reason) before rendering the signature tables, so a forged entry cannot inject terminal escapes or break the table layout. - Document on AuditIndexRequest.unresolvable why the bulk vulnerability audit intentionally does not consume it: its output is the registry's advisory report, which has no slot for lockfile-integrity failures, and inventing one would break --json consumers. Signature auditing is where those belong. - Bump `@pnpm/deps.compliance.audit` and `@pnpm/deps.security.signatures` to minor: the new AuditIndexRequest field and the sortIssue export are additive public API. - Extend tests: nested (below-importer) unresolvable references, cross-lockfile de-duplication, and two command-level cases covering aggregation into audited/invalid, sorting, exit code 1, and the unresolvable-only lockfile that previously died on AUDIT_NO_PACKAGES. Written by an agent (Claude Code, claude-sonnet-5).
CodeRabbit and Greptile both flagged that the Rust CLI's audit- signatures request builder still has the same unresolvable-entry gap this PR fixes on the TypeScript side, and Greptile scored the PR not-yet-mergeable on that basis. Document the gap explicitly in the changeset, per the review's own suggested resolution, rather than leave it unacknowledged.
Per review: the comments narrated the condition and the assertions sitting directly below them, which is the kind of duplication that drifts as soon as either side changes. Kept the two that say something the code does not: why an unresolvable reference is reported instead of looked up in a registry, and what makes the fixture lockfile inconsistent. Comments only -- no line of code changed. Written by an agent (Claude Code, claude-fable-5).
…ockfile order The unresolvable entries are folded into result.invalid through sortIssue, but nothing pinned that: the only-unresolvable fixture carried a single entry, so the sort could have been dropped without a test noticing. Give the fixture a second unresolvable reference, absent-pkg, listed after gone-pkg in the lockfile but sorting before it. LockfileWalkerStep.missing preserves the order the references are declared in, so the rendered order can only be absent-pkg first if the sort actually ran. Revert-checked: dropping .sort(sortIssue) makes the new assertion fail with absent-pkg rendered at index 815 instead of ahead of gone-pkg at 317.
upstream renamed AuditOptions.registries to registriesByScope, so the unresolvable-entry branch added by this PR no longer typechecks against current main and TS CI fails with TS2339. Read the renamed field. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
d7ee05a to
d15ba38
Compare
Code Review by Qodo
1. Broken lockfiles pass audit in v12
|
| if (auditRequest.unresolvable.length > 0) { | ||
| const unresolvableIssues: SignatureIssue[] = auditRequest.unresolvable.map(({ name, depPath }) => ({ | ||
| name, | ||
| registry: pickRegistryForPackage(opts.registriesByScope, name), |
There was a problem hiding this comment.
1. Broken lockfiles pass audit in v12 📜 Skill insight ⌂ Architecture
audit signatures in v12 registers dependency keys before checking for a snapshot, so it can send a dangling reference to the registry as an ordinary package while this PR marks it invalid only in v11. If that package has a valid registry signature, the Rust command can exit successfully for the broken lockfile, and no Rust regression test covers this scenario.
Agent Prompt
## Issue description
The dangling-lockfile-reference defect affects both implementations, but this PR only makes the TypeScript command fail closed. The Rust implementation can still treat a dependency missing from `snapshots` as an ordinary registry package, and it has no equivalent regression coverage.
## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/audit/request.rs[260-279]
- pnpm/crates/cli/src/cli_args/audit/importers.rs[49-82]
- pnpm/crates/cli/src/cli_args/audit/signatures.rs[115-148]
- pnpm/crates/cli/tests/suite/audit/signatures.rs[1-302]
## Recommended Fix
Carry unresolved dependency references through the Rust audit request, convert them into invalid signature issues, include them in the audited count, and return a nonzero exit code. Add a Rust CLI regression test using a dangling lockfile reference and assert the count, invalid issue, diagnostic output, and exit code; alternatively, explicitly document the deferred v12 implementation in the PR description.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
the referenced issue is fixed. |
lockfileToAuditRequest walks the lockfile via
lockfileWalkerGroupImporterSteps, whose LockfileWalkerStep already separates dependencies it resolved to a packages:/snapshots: entry from ones it couldn't (step.missing) -- but the visitor only ever read .dependencies, so a dangling reference (e.g. an importer still citing [email protected] after packages: was edited to only contain [email protected]) was silently dropped instead of counted or reported.
auditSignatures builds its package list directly from lockfileToAuditRequest's output, so those entries never reached verifySignatures either: the audited/verified counts shrank, missing and invalid stayed empty, and the command exited 0 against a lockfile it could not actually audit.
Collect step.missing at every level of the walk into a new unresolvable field on AuditIndexRequest, and have auditSignatures report each one as an invalid signature issue (there is no registry lookup to attempt for a reference the lockfile itself can't stand behind), folding it into
auditedso the denominator isn't quietly smaller than the lockfile actually claims.Closes #13638
Written by an agent (Claude Code, claude-sonnet-5).
Summary
pnpm audit signaturessilently dropped lockfile entries it couldn't resolve to apackages:/snapshots:entry, so a dangling dependency reference shrank the audited/verified counts instead of being reported, and the command exited 0 against a lockfile it could not actually audit. Collect those unresolvable entries and report each as an invalid signature issue, folding it intoauditedso the denominator matches what the lockfile actually claims.Squash Commit Body
fix(audit): surface unresolvable lockfile entries in audit signatures
lockfileToAuditRequest walks the lockfile via lockfileWalkerGroupImporterSteps,
whose LockfileWalkerStep already separates dependencies it resolved to a
packages:/snapshots: entry from ones it couldn't (step.missing) -- but the
visitor only ever read .dependencies, so a dangling reference (e.g. an
importer still citing [email protected] after packages: was edited to only contain
[email protected]) was silently dropped instead of counted or reported.
auditSignatures builds its package list directly from lockfileToAuditRequest's
output, so those entries never reached verifySignatures either: the
audited/verified counts shrank, missing and invalid stayed empty, and the
command exited 0 against a lockfile it could not actually audit.
Collect step.missing at every level of the walk into a new unresolvable field
on AuditIndexRequest, and have auditSignatures report each one as an invalid
signature issue (there is no registry lookup to attempt for a reference the
lockfile itself can't stand behind), folding it into
auditedso thedenominator isn't quietly smaller than the lockfile actually claims.
Closes #13638
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.(Not ported -- I did not find an equivalent audit-signatures code path
in the Rust port; flagging for a maintainer to confirm whether one exists.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
internal audit behavior.)
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
pnpm audit signaturesnow reports unresolved lockfile entries as invalid signature issues instead of silently ignoring them.Tests