fix(vex): avoid panic on CSAF advisory without a CVE - #10990
Open
dervoeti wants to merge 1 commit into
Open
Conversation
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.
Description
Scanning with a CSAF VEX document crashes with a nil pointer panic when the document contains a vulnerability that has no
cveproperty.The
cveproperty is optional in a CSAFvulnerabilitiesentry: an advisory may instead be identified only by itsids(for example a GitHub Security Advisory / GHSA identifier).CSAF.NotAffecteddereferenced*item.CVEunconditionally while searching for the matching advisory, so any such entry triggered a segfault:This change matches a vulnerability by its CVE when one is present and falls back to the
idsentries otherwise. This both fixes the panic and lets GHSA-only advisories be matched by their identifier.There is no associated issue, the fix is small and self-contained, so per the contributing guide I'm including the justification here instead.
Before
(where
advisory.jsonis a CSAF document containing at least onevulnerabilitiesentry that usesidsinstead ofcve, e.g.)After
The scan completes normally, and a GHSA-only
known_not_affected/fixedstatement now filters the matching detected vulnerability just like a CVE-based one.Related issues
N/A
Checklist