Skip to content

fix: preserve PURLs on CycloneDX dependencies - #2366

Open
codewithfourtix wants to merge 1 commit into
aboutcode-org:mainfrom
codewithfourtix:fix/sbom-dependency-purl-fields
Open

codewithfourtix wants to merge 1 commit into
aboutcode-org:mainfrom
codewithfourtix:fix/sbom-dependency-purl-fields

Conversation

@codewithfourtix

Copy link
Copy Markdown
Contributor

Issues

Changes

CycloneDX SBOM imports created dependency relationships without their PURL fields, even when the resolved package had a valid PURL. This left the dependency's Package URL and Type columns empty and caused populate_purldb to raise Invalid purl: type is a required argument.

Copy the PURL fields from the resolved package when creating these dependencies, using the existing PACKAGE_URL_FIELDS constant. Package relationships and dependency flags are preserved.

Add regression coverage for the reported Python PURL, a PURL with namespace, qualifiers and subpath, and collecting imported dependency PURLs for PurlDB. This applies to new imports; previously imported SBOMs need to be loaded again to populate the missing fields.

Validation

  • Confirmed the regression fails on the original code with the reported ValueError.
  • 36 tests passed on Python 3.12 with PostgreSQL 18: the complete resolve and PurlDB pipe test modules, plus PipelinesIntegrationTest.test_scanpipe_load_sbom_pipeline_cyclonedx_with_dependencies_integration.
  • Ruff lint and formatting passed (189 Python files).
  • Documentation lint, ABOUT validation, uv lock --check, and dependency compatibility checks passed.

Checklist

  • I have read the contributing guidelines
  • I have linked an existing issue above
  • I have added unit tests covering the new code
  • I have reviewed and understood every line of this PR

Copy package URL fields from the resolved package when creating SBOM
dependencies so they can be displayed and collected for PurlDB.

Cover the reported Python PURL and all package URL fields in regression
tests, including the PurlDB consumer.

Fixes aboutcode-org#1644

Signed-off-by: Ali Zulfiqar <codewithfourtix@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 06:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
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.

Exception when running populate_purldb on project where previous run was load_sbom

2 participants