Skip to content

fix: protect against unsupported resolution element for pnpm#184

Merged
piloulacdog merged 1 commit into
mainfrom
pierrelouis.lacorte/fix-pnpm-parser
Jul 3, 2026
Merged

fix: protect against unsupported resolution element for pnpm#184
piloulacdog merged 1 commit into
mainfrom
pierrelouis.lacorte/fix-pnpm-parser

Conversation

@piloulacdog

@piloulacdog piloulacdog commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Motivation

A pnpm v9 lockfile that pins pnpm's self-managed node runtime caused the entire scan to return zero packages, so SCA silently skipped every dependency in the repository.

  node@runtime:24.15.0:
    resolution:
      type: variations
      variants:
        - resolution: // <- generated an error during parsing, causing full ignore of the lock file
            archive: tarball
            bin:

📝 Summary

  • The pnpm v9 parser now tolerates the nested resolution shape used by pnpm's self-managed node runtime, so these lockfiles parse fully instead of failing.
  • A partial YAML decode is now surfaced as a warning while keeping the packages that did parse, instead of discarding the whole lockfile without a trace.

🧪 Testing

  • New tests were added for new logic.
  • Existing tests were updated for new logic, and not only so that they pass!
  • Benchmark results prove that performance is the same or better.

🚧 Staging validation

  • Proof that it works as expected, including profiling or UX screenshots.

before

datadog-sbom-generator scan --output='sbom.json' --pretty --verbosity verbose .
Scanning directory '.', resolved absolute path '/<path>/pnpm'
Scanned /<path>/pnpm/pnpm-lock.yaml file and found 0 packages
No package sources found. Use the 'parsers list' command to view supported lockfiles, or use --help for usage information

after

~datadog-sbom-generator/datadog-sbom-generator scan --output='sbom.json' --pretty --verbosity verbose .
Scanning directory '.', resolved absolute path '<path>/pnpm'
Scanned <path>/pnpm/pnpm-lock.yaml file and found 2406 packages
[reachability] Reachability analysis is disabled

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 3, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 25.00%
Overall Coverage: 84.22% (+0.05%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 993625f | Docs | Datadog PR Page | Give us feedback!

@piloulacdog
piloulacdog marked this pull request as ready for review July 3, 2026 09:45
@piloulacdog
piloulacdog requested a review from a team as a code owner July 3, 2026 09:45
resolution:
type: variations
variants:
- resolution:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wasn't supported before

@piloulacdog
piloulacdog merged commit 0ecd08d into main Jul 3, 2026
11 checks passed
@piloulacdog
piloulacdog deleted the pierrelouis.lacorte/fix-pnpm-parser branch July 3, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants