Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vex): CSAF support #1826

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' into feat/vex-csaf
juan131 committed Apr 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7cd816ad0143a67a40cf4ba518358f2f5ec4630f
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ require (
github.com/wagoodman/go-presenter v0.0.0-20211015174752-f9c01afc824b
github.com/wagoodman/go-progress v0.0.0-20230925121702-07e42b3cdba0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
gorm.io/gorm v1.25.9
gorm.io/gorm v1.25.10
)

require (

Unchanged files with check annotations Beta

continue
}
if *pID == m.ProductID {
return string(*th.Details)

Check failure on line 58 in grype/vex/csaf/csaf.go

GitHub Actions / Static analysis

unnecessary conversion (unconvert)
}
}
}
type advisories []*csaf.Advisory
// Matches returns the first CSAF advisory to match for a given vulnerability ID and package URL
func (advisories advisories) matches(vulnID, purl string) *advisoryMatch {

Check failure on line 69 in grype/vex/csaf/csaf.go

GitHub Actions / Static analysis

cognitive complexity 32 of func `(advisories).matches` is high (> 30) (gocognit)

Check failure on line 69 in grype/vex/csaf/csaf.go

GitHub Actions / Static analysis

unnecessary leading newline (whitespace)
for _, adv := range advisories {
if adv == nil || adv.Vulnerabilities == nil {
// The collection is sorted by date, so newer advisories are guaranteed to be consumed before.
sort.SliceStable(advs, func(i, j int) bool {
i_t, _ := time.ParseDateTime(*advs[i].Document.Tracking.CurrentReleaseDate)

Check failure on line 51 in grype/vex/csaf/implementation.go

GitHub Actions / Static analysis

var-naming: don't use underscores in Go names; var i_t should be iT (revive)

Check failure on line 51 in grype/vex/csaf/implementation.go

GitHub Actions / Static analysis

ST1003: should not use underscores in Go names; var i_t should be iT (stylecheck)
j_t, _ := time.ParseDateTime(*advs[j].Document.Tracking.CurrentReleaseDate)

Check failure on line 52 in grype/vex/csaf/implementation.go

GitHub Actions / Static analysis

var-naming: don't use underscores in Go names; var j_t should be jT (revive)

Check failure on line 52 in grype/vex/csaf/implementation.go

GitHub Actions / Static analysis

ST1003: should not use underscores in Go names; var j_t should be jT (stylecheck)
return i_t.Before(j_t)
})
// the VEX data as fixed or not_affected to the ignored list.
func (*Processor) FilterMatches(
docRaw interface{}, ignoreRules []match.IgnoreRule, _ *pkg.Context, matches *match.Matches, ignoredMatches []match.IgnoredMatch,
) (*match.Matches, []match.IgnoredMatch, error) {

Check failure on line 63 in grype/vex/csaf/implementation.go

GitHub Actions / Static analysis

unnecessary leading newline (whitespace)
advisories, ok := docRaw.(advisories)
if !ok {
// are moved from the ignore list or synthesized when no previous data is found.
func (*Processor) AugmentMatches(
docRaw interface{}, ignoreRules []match.IgnoreRule, _ *pkg.Context, matches *match.Matches, ignoredMatches []match.IgnoredMatch,
) (*match.Matches, []match.IgnoredMatch, error) {

Check failure on line 107 in grype/vex/csaf/implementation.go

GitHub Actions / Static analysis

unnecessary leading newline (whitespace)
advisories, ok := docRaw.(advisories)
if !ok {
You are viewing a condensed version of this merge commit. You can view the full changes here.