jfrog / jfrog/jfrog-cli-security

[audit] pnpm projects fail to generate SBOM and audits cannot continue

Open
#728 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
13
Forks
50
Avg merge
3d 48m
Merged PRs (30d)
26

Description

Describe the bug

PNPM has an issue generating SBOM files when they become very long, as it tries to serialize a single, large blob of JSON.

Internally, jf audit calls /path/to/pnpm ls --depth Infinity --json --long to gather enough information for the bill of materials.

Unfortunately NODE_OPTIONS=--max-old-space-size=8192 doesn't do the trick, and jf audit ignores the NODE_OPTIONS flag anyway.

Current behavior

Audit dies while waiting for pnpm ls --depth Infinity --json --long.

Audit reports error code 41, which again, doesn't really describe anything.

The error log contains "Error: Invalid string length", which isn't very descriptive.

Reproduction steps

Create a relatively complex NPM project and generate a pnpm-lock.yaml with PNPM.

(Hint: We are using the aws-sdk and several packages which depend on one another).

Run jf audit on your project.

Expected behavior

Audit completes; or I can generate my own SBOM and provide it as a command line switch.

JFrog CLI version

2.85.0

Operating system type and version

Ubuntu 25.04 plucky

JFrog Artifactory version

unknown

JFrog Xray version

unknown

Related

https://github.com/pnpm/pnpm/issues/9088#issuecomment-2659352351

pnpm ls command and json printer
https://github.com/pnpm/pnpm/blob/6b18b795b7d4e1b9c780aaf0c49c68da0502a0b2/reviewing/list/src/index.ts#L136
https://github.com/pnpm/pnpm/blob/6b18b795b7d4e1b9c780aaf0c49c68da0502a0b2/reviewing/list/src/renderJson.ts#L50

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 at the jf audit path that invokes pnpm ls --depth Infinity --json --long for SBOM generation, then review pnpm's linked reviewing/list/src/index.ts and reviewing/list/src/renderJson.ts. Reproduce the failure with a complex pnpm project and verify that audit can complete or accept a user-provided SBOM, with a more descriptive failure when it cannot.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, node.js
Domain
cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.