Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 7 additions & 1 deletion rhel/vex/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ func (u *Updater) DeltaParse(ctx context.Context, contents io.ReadCloser) ([]*cl
}
}
vulns := []*claircore.Vulnerability{}
for _, vs := range out {
for n, vs := range out {
if len(vs) == 0 {
// If there are no vulns for this CVE make sure we signal that
// it is deleted in case it once had vulns.
deleted = append(deleted, n)
continue
}
vulns = append(vulns, vs...)
}

Expand Down
4 changes: 2 additions & 2 deletions rhel/vex/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ func TestParse(t *testing.T) {
expectedDeleted int
}{
{
name: "six_advisories_two_deletions",
name: "six_advisories_four_deletions",
filename: "testdata/example_vex.jsonl",
expectedVulns: 546,
expectedDeleted: 2,
expectedDeleted: 4,
},
{
name: "cve-2022-1705",
Expand Down
12 changes: 1 addition & 11 deletions rhel/vex/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
deletionsFile = "deletions.csv"
lookBackToYear = 2014
repoKey = "rhel-cpe-repository"
updaterVersion = "2"
updaterVersion = "3"
)

// Factory creates an Updater to process all of the Red Hat VEX data.
Expand Down Expand Up @@ -110,16 +110,6 @@ type fingerprint struct {
version string
}

// NewFingerprint creates a new fingerprint object.
func newFingerprint(changesEtag string, deletionsEtag string, requestTime time.Time) *fingerprint {
return &fingerprint{
changesEtag: changesEtag,
deletionsEtag: deletionsEtag,
requestTime: requestTime,
version: updaterVersion,
}
}

// ParseFingerprint takes a generic driver.Fingerprint and creates a vex.fingerprint.
// The string format saved in the DB is returned by the fingerprint.String() method.
func parseFingerprint(in driver.Fingerprint) (*fingerprint, error) {
Expand Down
Loading