Decide the malicious verdict from the purl, not a sibling field - #14
Merged
Conversation
The persist hook passed the SBOM's `version` field to the evaluator while keying the row on `purl_with_version`. The two can disagree: omit `version` and it defaults to "0.0.0", which a version-pinned advisory reads as "not one of the named versions" and clears the row. 12.4% of the snapshot is pinned, and `component_versions` is org-wide, so one upload could un-flag a package for every project sharing it. A flagged → clear transition now also logs a warning. That is normal when a snapshot refresh drops a withdrawn advisory, and worth looking at when a single scan does it.
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.
Found by the security review of #12.
The persist hook keys the catalog row on
purl_with_versionbut passed the SBOM's separateversionfield to the evaluator. Omit that field and it defaults to"0.0.0", which a version-pinned advisory reads as "not one of the named versions" — clearing a row that is genuinely malicious. 12.4% of the snapshot carries version pins, andcomponent_versionsis shared across the whole organization, so the effect is not scoped to the uploader.The verdict now derives from the same string the row is keyed on. A
flagged → cleartransition also logs a warning: normal when a snapshot refresh drops a withdrawn advisory, worth a look when one scan does it.The regression test was checked against the unfixed code — it fails there and passes here. The existing tests could not have caught this because they build the SBOM with both fields agreeing.
This lands before #12 on purpose. The gate axis in that PR turns a wrong stamp into a build-block bypass, so the stamp needs to be trustworthy first.