-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from knqyf263/feat/vuln_match
Better vulnerability match in EffectiveStatement
- Loading branch information
Showing
2 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ func TestEffectiveStatement(t *testing.T) { | |
vexDoc: &VEX{ | ||
Statements: []Statement{ | ||
{ | ||
Vulnerability: Vulnerability{ID: "CVE-2014-123456"}, | ||
Vulnerability: Vulnerability{Name: "CVE-2014-123456"}, | ||
Timestamp: &date1, | ||
Products: []Product{{Component: Component{ID: "pkg:deb/[email protected]"}}}, | ||
Status: StatusNotAffected, | ||
|
@@ -45,13 +45,13 @@ func TestEffectiveStatement(t *testing.T) { | |
vexDoc: &VEX{ | ||
Statements: []Statement{ | ||
{ | ||
Vulnerability: Vulnerability{ID: "CVE-2014-123456"}, | ||
Vulnerability: Vulnerability{Name: "CVE-2014-123456"}, | ||
Timestamp: &date1, | ||
Products: []Product{{Component: Component{ID: "pkg:deb/[email protected]"}}}, | ||
Status: StatusUnderInvestigation, | ||
}, | ||
{ | ||
Vulnerability: Vulnerability{ID: "CVE-2014-123456"}, | ||
Vulnerability: Vulnerability{Name: "CVE-2014-123456"}, | ||
Timestamp: &date2, | ||
Products: []Product{{Component: Component{ID: "pkg:deb/[email protected]"}}}, | ||
Status: StatusNotAffected, | ||
|
@@ -68,13 +68,13 @@ func TestEffectiveStatement(t *testing.T) { | |
vexDoc: &VEX{ | ||
Statements: []Statement{ | ||
{ | ||
Vulnerability: Vulnerability{ID: "CVE-2014-123456"}, | ||
Vulnerability: Vulnerability{Name: "CVE-2014-123456"}, | ||
Timestamp: &date1, | ||
Products: []Product{{Component: Component{ID: "pkg:deb/[email protected]"}}}, | ||
Status: StatusUnderInvestigation, | ||
}, | ||
{ | ||
Vulnerability: Vulnerability{ID: "CVE-2014-123456"}, | ||
Vulnerability: Vulnerability{Name: "CVE-2014-123456"}, | ||
Timestamp: &date2, | ||
Products: []Product{{Component: Component{ID: "pkg:deb/[email protected]"}}}, | ||
Status: StatusNotAffected, | ||
|
@@ -87,6 +87,32 @@ func TestEffectiveStatement(t *testing.T) { | |
expectedDate: &date1, | ||
expectedStatus: StatusUnderInvestigation, | ||
}, | ||
"Vulnerability aliases": { | ||
vexDoc: &VEX{ | ||
Statements: []Statement{ | ||
{ | ||
Vulnerability: Vulnerability{ | ||
Name: "CVE-2014-123456", | ||
Aliases: []VulnerabilityID{"ghsa-92xj-mqp7-vmcj"}, | ||
}, | ||
Timestamp: &date1, | ||
Products: []Product{{Component: Component{ID: "pkg:deb/[email protected]"}}}, | ||
Status: StatusUnderInvestigation, | ||
}, | ||
{ | ||
Vulnerability: Vulnerability{ID: "CVE-2014-123456"}, | ||
Timestamp: &date2, | ||
Products: []Product{{Component: Component{ID: "pkg:deb/[email protected]"}}}, | ||
Status: StatusNotAffected, | ||
}, | ||
}, | ||
}, | ||
vulnID: "ghsa-92xj-mqp7-vmcj", | ||
product: "pkg:deb/[email protected]", | ||
shouldNil: false, | ||
expectedDate: &date1, | ||
expectedStatus: StatusUnderInvestigation, | ||
}, | ||
} { | ||
s := tc.vexDoc.EffectiveStatement(tc.product, tc.vulnID) | ||
if tc.shouldNil { | ||
|