Skip to content

Fix missing nested packages in package-lock.json v1 - #5108

Merged
wagoodman merged 2 commits into
anchore:mainfrom
Eljees:agent/fix-package-lock-v1-nested
Jul 27, 2026
Merged

Fix missing nested packages in package-lock.json v1#5108
wagoodman merged 2 commits into
anchore:mainfrom
Eljees:agent/fix-package-lock-v1-nested

Conversation

@Eljees

@Eljees Eljees commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Description

Catalog nested dependency entries in npm package-lock v1 files. Previously, Syft only visited the top-level dependency map, so conflicting versions installed below another package were missing from the SBOM.

This change:

  • recursively walks nested v1 dependency maps
  • keeps distinct package versions while deduplicating repeated name/version pairs
  • skips complete dev-only subtrees when dev dependencies are disabled
  • adds a multi-level regression fixture covering all three cases

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (please discuss with the team first; Syft is 1.0 software and we won't accept breaking changes without going to 2.0)
  • Documentation (updates the documentation)
  • Chore (improve the developer experience, fix a test flake, etc, without changing the visible behavior of Syft)
  • Performance (make Syft run faster or use less memory, without changing visible behavior much)

Testing

  • go test ./syft/pkg/cataloger/javascript -count=1
  • go vet ./syft/pkg/cataloger/javascript

Checklist

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Issue references

Fixes #5101

Eljees added 2 commits July 27, 2026 02:39
Signed-off-by: Eljees <57435526+Eljees@users.noreply.github.com>
Signed-off-by: Eljees <57435526+Eljees@users.noreply.github.com>
@wagoodman
wagoodman merged commit 1286689 into anchore:main Jul 27, 2026
15 checks passed
@Eljees

Eljees commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

I'm glad could have helped!!

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.

package-lock.json v1: nested dependencies entries are never cataloged (flat top-level iteration only)

2 participants