Skip to content

fix(enrichment): clean up dependencies when filtering lockfile components#66

Merged
vpetersson merged 1 commit intomasterfrom
fix-augmentation
Dec 13, 2025
Merged

fix(enrichment): clean up dependencies when filtering lockfile components#66
vpetersson merged 1 commit intomasterfrom
fix-augmentation

Conversation

@vpetersson
Copy link
Contributor

When removing lockfile components (uv.lock, requirements.txt, etc.) from SBOMs, the dependency/relationship references were not being cleaned up, causing serialization to fail with "Dependency references to Components that are not known in this BOM" errors.

Changes:

  • CycloneDX: Update _filter_lockfile_components to remove lockfile refs from bom.dependencies and nested dependsOn lists
  • SPDX: Add _is_lockfile_package and _filter_lockfile_packages to filter lockfile packages and clean up document.relationships
  • Fix existing e2e test to include realistic dependencies like Trivy generates, preventing this class of bugs from slipping through again
  • Add comprehensive unit tests for both CycloneDX and SPDX dependency cleanup

…ents

When removing lockfile components (uv.lock, requirements.txt, etc.) from
SBOMs, the dependency/relationship references were not being cleaned up,
causing serialization to fail with "Dependency references to Components
that are not known in this BOM" errors.

Changes:
- CycloneDX: Update _filter_lockfile_components to remove lockfile refs
  from bom.dependencies and nested dependsOn lists
- SPDX: Add _is_lockfile_package and _filter_lockfile_packages to filter
  lockfile packages and clean up document.relationships
- Fix existing e2e test to include realistic dependencies like Trivy
  generates, preventing this class of bugs from slipping through again
- Add comprehensive unit tests for both CycloneDX and SPDX dependency
  cleanup
Copilot AI review requested due to automatic review settings December 13, 2025 17:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where removing lockfile components/packages from SBOMs caused serialization errors due to dangling dependency/relationship references.

Key Changes:

  • Updated CycloneDX filtering to clean up bom.dependencies entries and nested dependsOn lists
  • Added SPDX filtering functions (_is_lockfile_package, _filter_lockfile_packages) to remove lockfile packages and their relationships
  • Enhanced existing e2e test with realistic dependency structures to prevent regression

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
sbomify_action/enrichment.py Added dependency/relationship cleanup logic to both CycloneDX and SPDX lockfile filtering functions
tests/test_enrichment_module.py Added comprehensive unit tests for dependency cleanup and updated e2e test with realistic dependency graphs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vpetersson vpetersson merged commit e365ff3 into master Dec 13, 2025
5 checks passed
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.

1 participant