Refactor dependency handling for spdx/cdx #599
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #598
This PR adds the following changes:
The previous dependency logic for most compliances were similar especially across profiles. Due to which it causes incorrect and misleading results. One of the most incorrect logic was checking every component for dependencies and scoring it as valid only if had at least one dependency. This causes 2 major issues:
And also we evaluated SBOM-level depdnecny for primary component and for Component-level depndencies separately, even although most compliance do not distinguish b/w these as independent requiements.
Because of this, the depdnency logic needed a correction and strictness for their compliance standards. So, as I started digging out more strictly with the defintion of each compliances, found that each defintion had their different motive for dependencies.
For example,
Official Defintion
1. BSI (TR-03183-2 v1.1 / v2.0 / v2.1)
Key implications:
2. FSCT (Framing Software Component Transparency)
Key implications:
Basically, an SBOM
3. NTIA Minimum Elements
Key implications:
3.Interlynk (Internal Profile)
What's new added ?
Major changes
Refactored dependency handling to use a unified, spec-agnostic relationship graph.
Added the following methods to the document interface:
GetRelationships()Returns all relationships of all types in the SBOM. This acts as the source of truth for dependency and relationship analysis.
GetOutgoingRelations(compID)Returns all outgoing relationships for a specific component, regardless of relationship type (e.g.
DEPENDS_ON,CONTAINS, etc.).GetDirectDependencies(compID, relTypes...)Returns all direct dependencies of a component filtered by relationship type.
For example, providing a component ID with
DEPENDS_ONreturns only its direct runtime/build dependencies.