Repository navigation
fix(sbom): use canonical versions for risk classification - #119
Merged
Merged
Conversation
Signed-off-by: stacknil <219124580+stacknil@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #118.
Summary
Use the existing canonical identity versions in
_version_change_findings()so risk classification retains version evidence present only in PURLs.
Add focused risk and CycloneDX/SPDX policy/report regressions and document
the evidence source.
Why
The diff already recognizes a PURL-only
1.2.3to2.0.0change, but the risklayer compares two absent raw versions and emits no version finding. An
existing
major_upgradeblocking rule consequently returns 0.Behavior change
version_change_unclassifiedfallback. Minor changes and downgrades are notpromoted to major upgrades; missing canonical versions stay unknown.
finding can remove its block. Warnings and suppressions retain exit 0.
Corrected matches, including suppressed matches, use existing
policy_matchedconfidence. Unmatched rules do not change policy decisions or confidence.
Validation
Base:
888d28f8836bda0898cc6a64b26f1c02bcf4868a.From
tools/sbom-diff-and-risk, the exact four-file candidate passes:python -m pytest tests/test_risk.py tests/test_version_evidence.py -q: 57 passed.python -m pytest -q: 272 passed, including existing golden/schema tests.E4,E7,E9,F) and clean-base patch application checks.changes confined to corrected findings matching existing rules.
Preserved red run with the final regressions against unchanged production:
25 failed / 32 passed. Existing 32-case synthetic evidence was retained.
Tests used Windows/Python 3.12.7 with network connections blocked. No Python
3.11 interpreter was found in inspected locations; Linux/3.11 was not run locally.
Compatibility
Canonicalization rules, conflict rejection, opaque identities, raw component
fields/evidence, SemVer criteria, policy rules, report schemas, ordering, and
offline defaults are unchanged. No goldens or dependencies change. Markdown
continues to display raw version fields; PURL-only version cells remain blank.
Rollback: revert this change; no data or schema migration is required.