Skip to content

fix(audit): do not invent patched versions from <= vulnerable ranges - #13614

Closed
EduardoFernandess wants to merge 2 commits into
pnpm:mainfrom
EduardoFernandess:fix/12651-no-invented-audit-patch
Closed

EduardoFernandess wants to merge 2 commits into
pnpm:mainfrom
EduardoFernandess:fix/12651-no-invented-audit-patch

Conversation

@EduardoFernandess

@EduardoFernandess EduardoFernandess commented Aug 3, 2026 •

Copy link
Copy Markdown

Summary

Fixes #12651.

inferPatchedVersions turned vulnerable_versions: "<=4.18.0" into patched_versions: ">=4.18.1" via semver.inc. audit --fix=override then wrote ^4.18.1. When that patch never existed (only a later major fixed the issue), install failed with ERR_PNPM_NO_MATCHING_VERSION.

Change

Infer patched ranges only from exclusive upper bounds (<X.Y.Z). Inclusive <=X.Y.Z no longer invents the next patch; patched_versions stays undefined and auto-fix is skipped (same as other ranges we cannot map to a fix).

Exclusive <2.0.0 → >=2.0.0 behavior is unchanged.

Test plan

  • Unit test: bulk advisory with <=4.18.0 yields undefined patched_versions
  • Existing <2.0.0 → >=2.0.0 coverage remains

Summary by CodeRabbit

  • Bug Fixes
    • Corrected vulnerability audits so inclusive ranges (for example, <=4.18.0) no longer infer an incorrect patched version.
    • Updated audit fixes to avoid creating unnecessary dependency overrides for inclusive vulnerable ranges.
    • Preserved patched-version inference for exclusive ranges such as <X.Y.Z.

inferPatchedVersions used semver.inc on `<=X.Y.Z` to produce `>=X.Y.(Z+1)`.
When no such release exists, audit --fix wrote a caret override like
`^4.18.1` that cannot install (ERR_PNPM_NO_MATCHING_VERSION).

Only infer patches from exclusive `<X.Y.Z` bounds, which name a real
first fixed version. Inclusive `<=` ranges leave patched_versions
undefined so auto-fix is skipped.

Fixes #12651

Co-authored-by: Cursor <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92cdac82-6965-474e-adab-d6216fb83306

📥 Commits

Reviewing files that changed from the base of the PR and between 075e356 and d433b7b.

⛔ Files ignored due to path filters (1)
  • pnpm11/deps/compliance/commands/test/audit/__snapshots__/index.ts.snap is excluded by !**/*.snap, !**/*.snap
📒 Files selected for processing (1)
  • pnpm11/deps/compliance/commands/test/audit/fix.ts

📝 Walkthrough

Walkthrough

The audit logic no longer infers patched versions from vulnerable ranges using inclusive <=X.Y.Z bounds. Tests verify that such ranges do not produce patched versions or audit-fix overrides.

Changes

Audit patched version inference

Layer / File(s) Summary
Inclusive range handling
pnpm11/deps/compliance/audit/src/index.ts, pnpm11/deps/compliance/audit/test/index.ts, pnpm11/deps/compliance/commands/test/audit/fix.ts
inferPatchedVersions retains support for exclusive <X.Y.Z bounds and returns no inferred patched version for inclusive bounds. Audit tests cover mjml@<=4.18.0 and prevent an axios@<=0.18.0 override for ^0.18.1.

Estimated code review effort: 2 (Simple) | ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Prevent pnpm audit --fix=override from inventing a patched dependency version for advisories with <=X.Y.Z vulnerable ranges [#12651] ✅

Possibly related PRs

  • pnpm/pnpm#13159: Both changes address inferred patched versions for inclusive vulnerable ranges.

Suggested labels: product: pnpm@11

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix audit: avoid inventing patched versions from inclusive (<=) vulnerable ranges

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Stop inferring patched_versions from inclusive <=X.Y.Z vulnerable ranges to avoid non-existent
 fixes.
• Keep inferring fixes only from exclusive <X.Y.Z upper bounds (first fixed version is explicit).
• Add a regression test ensuring <= advisories leave patched_versions undefined and skip
 auto-fix.
Diagram

graph TD
  A["audit()"] --> B{{"Registry advisories"}} --> C["normalizeAdvisory()"] --> D["inferPatchedVersions()"] --> E["patched_versions?"] --> F["audit --fix override"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Validate inferred fix against published versions
  • ➕ Could still auto-fix some &lt;= advisories by finding the next actually published non-vulnerable version
  • ➕ Avoids skipping fixes when a same-line patch does exist but advisory uses &lt;=
  • ➖ Requires extra registry metadata queries and caching/error handling
  • ➖ More complex and potentially slower; changes semantics beyond simple normalization
2. Defer fix mapping entirely to the fix/override stage
  • ➕ Keeps advisory normalization pure; fix logic can decide if/when to infer or verify installability
  • ➕ Could add installability checks (e.g., avoid writing overrides for non-existent versions)
  • ➖ Spreads range-inference behavior across modules and makes it harder to reason about advisory fields
  • ➖ Still needs a strategy for &lt;= ranges (likely ends up skipping anyway)

Recommendation: Current approach (only infer from exclusive &lt;X.Y.Z bounds and treat &lt;= as unknown) is the safest and most predictable because it avoids generating non-existent versions that break installs. Alternative strategies that query/validate against registry versions could recover some auto-fixes, but add meaningful complexity and runtime/network coupling that likely isn’t justified for audit normalization.

Files changed (2) +50 / -9

Bug fix (1) +9 / -9
index.tsStop inferring patched ranges from inclusive '<=' upper bounds +9/-9

Stop inferring patched ranges from inclusive '<=' upper bounds

• Updates 'inferPatchedVersions' to only map exclusive upper bounds ('<X.Y.Z') to a patched range ('>=X.Y.Z'). Removes the prior '<=X.Y.Z' → '>=X.Y.(Z+1)' behavior to avoid inventing non-existent releases that can produce un-installable overrides.

pnpm11/deps/compliance/audit/src/index.ts

Tests (1) +41 / -0
index.tsAdd regression test for '<=' vulnerable range behavior +41/-0

Add regression test for '<=' vulnerable range behavior

• Adds a unit test that mocks a bulk advisory with 'vulnerable_versions: "<=4.18.0"' and asserts 'patched_versions' remains undefined. This protects the new behavior and ensures auto-fix is skipped for inclusive upper bounds.

pnpm11/deps/compliance/audit/test/index.ts

@greptile-apps

greptile-apps Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains within the scope of this follow-up review.

Reviews (2): Last reviewed commit: "test(audit): update expectations when <=..." | Re-trigger Greptile

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 3, 2026
@qodo-code-review

qodo-code-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (3) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Remediation recommended

1. Substring version assertion 🐞 Bug ⚙ Maintainability ⭐ New
Description
The new not.toContain('0.18.1') assertion checks a merged minimumReleaseAgeExclude spec via
unbounded substring matching, so a future version like 0.18.10 would incorrectly fail the test due
to prefix collision. This makes CI/regression behavior fragile to unrelated advisory/version
changes.
Code

pnpm11/deps/compliance/commands/test/audit/fix.ts[54]

+  expect(axiosExclude).not.toContain('0.18.1')
Relevance

●●● Strong

Team often accepts de-brittling tests; e.g. moved from substring/YAML matching to structured
assertions (PR #13372).

PR-#13372
PR-#12467
PR-#13101

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed test line uses substring matching on the merged exclude spec; the exclude spec is
constructed as ${module}@${version} entries and then merged into a single string per module, which
is susceptible to prefix collisions when checking via toContain/not.toContain.

pnpm11/deps/compliance/commands/test/audit/fix.ts[51-56]
pnpm11/deps/compliance/commands/src/audit/fix.ts[59-69]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The test currently asserts absence of `0.18.1` using substring matching on a merged `minimumReleaseAgeExclude` string, which can produce false failures when other versions share the same prefix (e.g. `0.18.10`).

## Issue Context
`minimumReleaseAgeExclude` entries are produced by stringifying versions and then merging them into a single spec per module, so exact-token comparisons are safer than substring comparisons.

## Fix Focus Areas
- pnpm11/deps/compliance/commands/test/audit/fix.ts[51-56]

### Suggested direction
Parse `axiosExclude` into discrete version tokens (e.g., split after `axios@` by `,` / whitespace depending on the format) and assert that the resulting array/set does not contain the exact token `0.18.1`. Alternatively, use a boundary-aware regex like `/(^|[^0-9])0\.18\.1([^0-9]|$)/` with `not.toMatch(...)`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Overbroad falsy override check 🐞 Bug ⚙ Maintainability
Description
The new test uses toBeFalsy() to assert the axios@<=0.18.0 override is absent, which would still
pass if the override key exists but is written as an empty string (or other falsy value). This
weakens the regression test for audit --fix overrides, which are expected to be non-empty strings.
Code

pnpm11/deps/compliance/commands/test/audit/fix.ts[R45-48]

+  // Inclusive `<=0.18.0` must not invent `^0.18.1` (see #12651). Exclusive
+  // upper bounds still produce overrides.
+  expect(manifest.overrides?.['axios@<=0.18.0']).toBeFalsy()
+  expect(manifest.overrides?.['axios@<0.21.2']).toBe('^0.21.2')
Relevance

●●● Strong

Team frequently accepts tightening tests to avoid vacuous/overbroad assertions (e.g., require
defined/non-empty before comparing).

PR-#12179
PR-#11169

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The modified test uses a broad falsiness assertion for the override entry, while the fix
implementation produces string override values (caret ranges) when an advisory is fixable.
Therefore, the test should assert absence explicitly rather than rely on truthiness.

pnpm11/deps/compliance/commands/test/audit/fix.ts[44-56]
pnpm11/deps/compliance/commands/src/audit/fix.ts[41-57]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The test currently checks `manifest.overrides?.['axios@<=0.18.0']` with `toBeFalsy()`, which cannot distinguish between an absent override entry and a present-but-invalid falsy override value.

### Issue Context
Overrides written by `audit --fix` are intended to be non-empty semver range strings (e.g. `^x.y.z`). The test should specifically assert that the override entry is not created.

### Fix Focus Areas
- pnpm11/deps/compliance/commands/test/audit/fix.ts[45-48]

### Suggested change
Replace the falsy assertion with a strict absence assertion, e.g.:
- `expect(manifest.overrides).not.toHaveProperty('axios@<=0.18.0')`, or
- `expect(manifest.overrides?.['axios@<=0.18.0']).toBeUndefined()` (if absence maps to `undefined` in this read path).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Comment mentions semver.inc 📘 Rule violation ⚙ Maintainability
Description
The updated comment references a removed/historical implementation detail (semver.inc) rather than
strictly describing current behavior/contract. This makes the comment stale-prone and violates the
rule against historical implementation commentary.
Code

pnpm11/deps/compliance/audit/src/index.ts[R196-199]

+  // Do NOT invent a patch from `<=X.Y.Z` via semver.inc: when no same-line fix
+  // exists (common for "all versions through X are vulnerable"), that invented
+  // version becomes a caret override like `^X.Y.(Z+1)` that cannot install
+  // (see https://github.com/pnpm/pnpm/issues/12651). Callers treat undefined
Relevance

●●● Strong

Team often accepts rewriting comments to avoid historical/removed-implementation phrasing (e.g. PRs
#13559, #13138).

PR-#13559
PR-#13138

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The comment explicitly calls out an old mechanism (semver.inc) that is no longer part of the
current implementation, which is precisely the kind of historical-implementation commentary this
rule disallows.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm11/deps/compliance/audit/src/index.ts[192-200]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A new/modified comment references a historical implementation detail (`semver.inc`) instead of documenting the current behavior.

## Issue Context
The current implementation behavior is: only infer `patched_versions` from an exclusive upper bound (`<X.Y.Z`); for `<=X.Y.Z` return `undefined`.

## Fix Focus Areas
- pnpm11/deps/compliance/audit/src/index.ts[192-200]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. audit --fix parity missing 📘 Rule violation ⌂ Architecture
Description
The TypeScript audit --fix tests now assert that inclusive vulnerable ranges like <=0.18.0 must
not produce an override, but Pacquet's Rust infer_patched_versions still invents a next-patch fix
for <= ranges. This creates a user-visible behavior divergence between pnpm and pacquet without an
explicit call-out in the PR description or a matching implementation change.
Code

pnpm11/deps/compliance/commands/test/audit/fix.ts[R45-48]

+  // Inclusive `<=0.18.0` must not invent `^0.18.1` (see #12651). Exclusive
+  // upper bounds still produce overrides.
+  expect(manifest.overrides?.['axios@<=0.18.0']).toBeFalsy()
+  expect(manifest.overrides?.['axios@<0.21.2']).toBe('^0.21.2')
Relevance

● Weak

Parity callout requests often rejected; REVIEW_GUIDE limits pnpm↔pacquet parity to
install/add/update/remove, not audit.

PR-#12522
PR-#13594

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The updated pnpm TypeScript test asserts that audit --fix should not generate an override for
axios@<=0.18.0, indicating the intended user-visible behavior is to skip auto-fix for inclusive
upper bounds. Pacquet's Rust implementation still handles <= by constructing >=(patch+1), which
would continue to generate an override and diverge from pnpm unless updated or explicitly documented
as a known divergence.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pnpm11/deps/compliance/commands/test/audit/fix.ts[45-48]
pnpm/crates/cli/src/cli_args/audit.rs[1427-1441]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
pnpm (TypeScript) behavior is being updated so `audit --fix` does not invent a patched version for inclusive `<=X.Y.Z` vulnerable ranges, but pacquet (Rust) still increments the patch for `<=` and will keep generating overrides.

## Issue Context
Compliance requires pnpm TypeScript and pacquet Rust user-visible behavior changes to stay in sync, or for the PR description to explicitly call out any known divergence and follow-up.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/audit.rs[1427-1442]
- pnpm11/deps/compliance/commands/test/audit/fix.ts[45-48]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Missing trailing comma in audit() 📘 Rule violation ⚙ Maintainability
Description
The new multi-line audit(...) call omits a trailing comma after the last argument. This violates
the TypeScript trailing-comma requirement and makes future diffs noisier.
Code

pnpm11/deps/compliance/audit/test/index.ts[R793-795]

+        getAuthHeader,
+        { registry, retry: { retries: 0 } }
+      )
Relevance

● Weak

Trailing-comma formatting suggestions are frequently rejected in TS reviews (e.g. PRs #13289,
#13477).

PR-#13289
PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The call to audit( spans multiple lines and the last argument (`{ registry, retry: { retries: 0 }
}) is not followed by a trailing comma before the closing )`, which violates the trailing-comma
rule for multi-line constructs.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/deps/compliance/audit/test/index.ts[780-796]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A multi-line function call is missing a trailing comma after the last argument.

## Issue Context
The repository requires trailing commas in multi-line TypeScript constructs, including argument lists.

## Fix Focus Areas
- pnpm11/deps/compliance/audit/test/index.ts[780-796]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit d433b7b ⚖️ Balanced

Results up to commit 075e356 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (2) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Comment mentions semver.inc 📘 Rule violation ⚙ Maintainability
Description
The updated comment references a removed/historical implementation detail (semver.inc) rather than
strictly describing current behavior/contract. This makes the comment stale-prone and violates the
rule against historical implementation commentary.
Code

pnpm11/deps/compliance/audit/src/index.ts[R196-199]

+  // Do NOT invent a patch from `<=X.Y.Z` via semver.inc: when no same-line fix
+  // exists (common for "all versions through X are vulnerable"), that invented
+  // version becomes a caret override like `^X.Y.(Z+1)` that cannot install
+  // (see https://github.com/pnpm/pnpm/issues/12651). Callers treat undefined
Relevance

●●● Strong

Team often accepts rewriting comments to avoid historical/removed-implementation phrasing (e.g. PRs
#13559, #13138).

PR-#13559
PR-#13138

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The comment explicitly calls out an old mechanism (semver.inc) that is no longer part of the
current implementation, which is precisely the kind of historical-implementation commentary this
rule disallows.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm11/deps/compliance/audit/src/index.ts[192-200]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A new/modified comment references a historical implementation detail (`semver.inc`) instead of documenting the current behavior.

## Issue Context
The current implementation behavior is: only infer `patched_versions` from an exclusive upper bound (`<X.Y.Z`); for `<=X.Y.Z` return `undefined`.

## Fix Focus Areas
- pnpm11/deps/compliance/audit/src/index.ts[192-200]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
2. Missing trailing comma in audit() 📘 Rule violation ⚙ Maintainability
Description
The new multi-line audit(...) call omits a trailing comma after the last argument. This violates
the TypeScript trailing-comma requirement and makes future diffs noisier.
Code

pnpm11/deps/compliance/audit/test/index.ts[R793-795]

+        getAuthHeader,
+        { registry, retry: { retries: 0 } }
+      )
Relevance

● Weak

Trailing-comma formatting suggestions are frequently rejected in TS reviews (e.g. PRs #13289,
#13477).

PR-#13289
PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The call to audit( spans multiple lines and the last argument (`{ registry, retry: { retries: 0 }
}) is not followed by a trailing comma before the closing )`, which violates the trailing-comma
rule for multi-line constructs.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/deps/compliance/audit/test/index.ts[780-796]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A multi-line function call is missing a trailing comma after the last argument.

## Issue Context
The repository requires trailing commas in multi-line TypeScript constructs, including argument lists.

## Fix Focus Areas
- pnpm11/deps/compliance/audit/test/index.ts[780-796]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit d433b7b ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Overbroad falsy override check 🐞 Bug ⚙ Maintainability
Description
The new test uses toBeFalsy() to assert the axios@<=0.18.0 override is absent, which would still
pass if the override key exists but is written as an empty string (or other falsy value). This
weakens the regression test for audit --fix overrides, which are expected to be non-empty strings.
Code

pnpm11/deps/compliance/commands/test/audit/fix.ts[R45-48]

+  // Inclusive `<=0.18.0` must not invent `^0.18.1` (see #12651). Exclusive
+  // upper bounds still produce overrides.
+  expect(manifest.overrides?.['axios@<=0.18.0']).toBeFalsy()
+  expect(manifest.overrides?.['axios@<0.21.2']).toBe('^0.21.2')
Relevance

●●● Strong

Team frequently accepts tightening tests to avoid vacuous/overbroad assertions (e.g., require
defined/non-empty before comparing).

PR-#12179
PR-#11169

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The modified test uses a broad falsiness assertion for the override entry, while the fix
implementation produces string override values (caret ranges) when an advisory is fixable.
Therefore, the test should assert absence explicitly rather than rely on truthiness.

pnpm11/deps/compliance/commands/test/audit/fix.ts[44-56]
pnpm11/deps/compliance/commands/src/audit/fix.ts[41-57]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The test currently checks `manifest.overrides?.['axios@<=0.18.0']` with `toBeFalsy()`, which cannot distinguish between an absent override entry and a present-but-invalid falsy override value.

### Issue Context
Overrides written by `audit --fix` are intended to be non-empty semver range strings (e.g. `^x.y.z`). The test should specifically assert that the override entry is not created.

### Fix Focus Areas
- pnpm11/deps/compliance/commands/test/audit/fix.ts[45-48]

### Suggested change
Replace the falsy assertion with a strict absence assertion, e.g.:
- `expect(manifest.overrides).not.toHaveProperty('axios@<=0.18.0')`, or
- `expect(manifest.overrides?.['axios@<=0.18.0']).toBeUndefined()` (if absence maps to `undefined` in this read path).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
2. audit --fix parity missing 📘 Rule violation ⌂ Architecture
Description
The TypeScript audit --fix tests now assert that inclusive vulnerable ranges like <=0.18.0 must
not produce an override, but Pacquet's Rust infer_patched_versions still invents a next-patch fix
for <= ranges. This creates a user-visible behavior divergence between pnpm and pacquet without an
explicit call-out in the PR description or a matching implementation change.
Code

pnpm11/deps/compliance/commands/test/audit/fix.ts[R45-48]

+  // Inclusive `<=0.18.0` must not invent `^0.18.1` (see #12651). Exclusive
+  // upper bounds still produce overrides.
+  expect(manifest.overrides?.['axios@<=0.18.0']).toBeFalsy()
+  expect(manifest.overrides?.['axios@<0.21.2']).toBe('^0.21.2')
Relevance

● Weak

Parity callout requests often rejected; REVIEW_GUIDE limits pnpm↔pacquet parity to
install/add/update/remove, not audit.

PR-#12522
PR-#13594

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The updated pnpm TypeScript test asserts that audit --fix should not generate an override for
axios@<=0.18.0, indicating the intended user-visible behavior is to skip auto-fix for inclusive
upper bounds. Pacquet's Rust implementation still handles <= by constructing >=(patch+1), which
would continue to generate an override and diverge from pnpm unless updated or explicitly documented
as a known divergence.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pnpm11/deps/compliance/commands/test/audit/fix.ts[45-48]
pnpm/crates/cli/src/cli_args/audit.rs[1427-1441]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
pnpm (TypeScript) behavior is being updated so `audit --fix` does not invent a patched version for inclusive `<=X.Y.Z` vulnerable ranges, but pacquet (Rust) still increments the patch for `<=` and will keep generating overrides.

## Issue Context
Compliance requires pnpm TypeScript and pacquet Rust user-visible behavior changes to stay in sync, or for the PR description to explicitly call out any known divergence and follow-up.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/audit.rs[1427-1442]
- pnpm11/deps/compliance/commands/test/audit/fix.ts[45-48]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Inclusive vulnerable ranges no longer invent patched_versions, so refresh
audit snapshots and assert auto-fix still works for exclusive bounds.

Co-authored-by: Cursor <[email protected]>
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit d433b7b

1 similar comment
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit d433b7b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PNPM invents a dependency version when running "audit fix"

1 participant