jfrog / jfrog/frogbot

scan-pull-request fails on pnpm 12: 'pnpm ls --depth ""' — MaxTreeDepth never set

Open
#1,422 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
372
Forks
107
Avg merge
2d 20h
Merged PRs (30d)
5

Description

Describe the bug

frogbot scan-pull-request fails on any pnpm project when pnpm 12 is on the runner's PATH, because Frogbot invokes pnpm ls with an empty --depth value:

[Info] Calculating Pnpm dependencies...
[Error] failed to audit target branch code for [.] project. Error: ...
failed to generate SBOM for /tmp/jfrog.cli.temp.-...: failed to build dependency tree:
failed while building 'pnpm' dependency tree: failed running command:
'/tmp/jfrog.cli.temp.-... /home/runner/.local/share/mise/installs/pnpm/12.3.4/pnpm ls --depth  --json --long'
with error: exit status 2 - error: invalid value '' for '--depth <DEPTH>': expected a non-negative integer, Infinity, or -1, got ``

pnpm ≤ 11 silently tolerated --depth ""; pnpm 12's stricter CLI parser rejects it.

Root cause

  • Frogbot builds AuditBasicParams in utils/scandetails.go (ScanDetails.Audit) and never calls SetMaxTreeDepth(...), so maxTreeDepth stays "".
  • jfrog-cli-security copies that straight through in commands/audit/auditparams.go (MaxTreeDepth: params.MaxTreeDepth()) and sca/bom/buildinfo/technologies/pnpm/pnpm.go calculateDependencies() does:
    lsArgs := append([]string{"--depth", params.MaxTreeDepth, "--json", "--long"}, params.Args...)
    
  • The "Infinity" default only exists on the jf audit --max-tree-depth CLI flag (cli/docs/flags.go), which Frogbot does not go through.

Reproduction

In any pnpm project:

npx -y pnpm@12 ls --depth "" --json --long   # exit 2, "invalid value '' for '--depth'"
npx -y pnpm@11 ls --depth "" --json --long   # exit 0

Environment

  • Frogbot 2.35.2 (also 2.35.3 — the release notes show no related change)
  • GitHub Actions, jfrog/frogbot action, scan-pull-request
  • pnpm 12.3.4 via mise
  • Node 26.8.1 (not relevant — the failure is pnpm's own arg parsing)

Suggested fix

Either have Frogbot call SetMaxTreeDepth("Infinity") when building AuditBasicParams, or have jfrog-cli-security default MaxTreeDepth to "Infinity" in calculateDependencies() / SetMaxTreeDepth when the value is empty. Happy to open a PR for either.

Workaround

Pin pnpm ≤ 11 on the runner until fixed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in utils/scandetails.go at ScanDetails.Audit and trace how AuditBasicParams reaches jfrog-cli-security's commands/audit/auditparams.go and sca/bom/buildinfo/technologies/pnpm/pnpm.go. Reproduce the failure with pnpm 12 using the documented pnpm ls command, then ensure the dependency-tree command no longer passes an empty depth and verify the command succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
security, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.