Summary
Some pnpm v9 lockfiles contain two YAML documents separated by ---: a bootstrap block (package-manager dependencies like pnpm@11.1.3) and the main project lockfile. CVE Lite currently calls YAML.parse() on pnpm-lock.yaml, which throws:
Error: Source contains multiple documents; please use YAML.parseAllDocuments()
Reproduction
- Clone apify/apify-mcp-server (or any repo with dual-document
pnpm-lock.yaml)
- Run
cve-lite /path/to/apify-mcp-server --json
- Scan fails before any findings are produced
Example upstream file: pnpm-lock.yaml — bootstrap document ends ~line 198, main project lockfile starts at second ---.
Expected behavior
CVE Lite should select the project lockfile document (the section with root importers[].dependencies / devDependencies and the large snapshots graph) and scan it normally.
Proposed fix
- Try
YAML.parse() first (single-document lockfiles unchanged)
- On multi-document error, use
YAML.parseAllDocuments() and pick the document with the highest score (dependency count + snapshot/package entries)
- Add regression test with minimal dual-document fixture
Impact
Without this fix, lockfile-only scans fail entirely for affected pnpm projects — no findings, no fix commands, no case-study baseline possible.
Opened by @Ayush7614. Local fix + regression test prepared; happy to open PR if maintainers confirm approach.
Summary
Some pnpm v9 lockfiles contain two YAML documents separated by
---: a bootstrap block (package-manager dependencies likepnpm@11.1.3) and the main project lockfile. CVE Lite currently callsYAML.parse()onpnpm-lock.yaml, which throws:Reproduction
pnpm-lock.yaml)cve-lite /path/to/apify-mcp-server --jsonExample upstream file:
pnpm-lock.yaml— bootstrap document ends ~line 198, main project lockfile starts at second---.Expected behavior
CVE Lite should select the project lockfile document (the section with root
importers[].dependencies/devDependenciesand the largesnapshotsgraph) and scan it normally.Proposed fix
YAML.parse()first (single-document lockfiles unchanged)YAML.parseAllDocuments()and pick the document with the highest score (dependency count + snapshot/package entries)Impact
Without this fix, lockfile-only scans fail entirely for affected pnpm projects — no findings, no fix commands, no case-study baseline possible.
Opened by @Ayush7614. Local fix + regression test prepared; happy to open PR if maintainers confirm approach.