forked from guacsec/guac
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] Unionize parsing for cdx SBOM and VEX data (guacsec#1247)
* calls vex parser from within cdx parser Signed-off-by: stevemenezes <[email protected]> * parse vulnerabilities within the Parse method Signed-off-by: stevemenezes <[email protected]> * remove redundant declarations Signed-off-by: stevemenezes <[email protected]> * delete unused files Signed-off-by: stevemenezes <[email protected]> * make fmt Signed-off-by: stevemenezes <[email protected]> * address comments Signed-off-by: stevemenezes <[email protected]> * modify timestamp Signed-off-by: stevemenezes <[email protected]> --------- Signed-off-by: stevemenezes <[email protected]>
- Loading branch information
1 parent
70a6fe2
commit a9dc7af
Showing
14 changed files
with
289 additions
and
580 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 |
---|---|---|
|
@@ -18,6 +18,7 @@ package testdata | |
import ( | ||
_ "embed" | ||
"encoding/base64" | ||
"fmt" | ||
"time" | ||
|
||
jsoniter "github.com/json-iterator/go" | ||
|
@@ -154,7 +155,7 @@ var ( | |
Status: generated.VexStatusNotAffected, | ||
VexJustification: generated.VexJustificationVulnerableCodeNotInExecutePath, | ||
Statement: "Automated dataflow analysis and manual code review indicates that the vulnerable code is not reachable, either directly or indirectly.", | ||
StatusNotes: "not_affected:code_not_reachable", | ||
StatusNotes: fmt.Sprintf("%s:%s", generated.VexStatusNotAffected, generated.VexJustificationVulnerableCodeNotInExecutePath), | ||
KnownSince: parseUTCTime("2020-12-03T00:00:00.000Z"), | ||
}, | ||
}, | ||
|
@@ -185,51 +186,43 @@ var ( | |
}, | ||
}, | ||
} | ||
CycloneDXUnAffectedPredicates = assembler.IngestPredicates{ | ||
VulnMetadata: CycloneDXUnAffectedVulnMetadata, | ||
Vex: CycloneDXUnAffectedVexIngest, | ||
} | ||
|
||
// CycloneDX VEX testdata in triage | ||
pkg1, _ = asmhelpers.PurlToPkg("pkg:maven/com.fasterxml.jackson.core/[email protected]") | ||
pkg2, _ = asmhelpers.PurlToPkg("pkg:maven/com.fasterxml.jackson.core/[email protected]") | ||
|
||
vulnSpecAffected = &generated.VulnerabilityInputSpec{ | ||
// CycloneDX VEX testdata affected packages. | ||
VulnSpecAffected = &generated.VulnerabilityInputSpec{ | ||
Type: "cve", | ||
VulnerabilityID: "cve-2021-44228", | ||
} | ||
vexDataAffected = &generated.VexStatementInputSpec{ | ||
Status: generated.VexStatusAffected, | ||
Statement: "Versions of Product ABC are affected by the vulnerability. Customers are advised to upgrade to the latest release.", | ||
StatusNotes: "exploitable:", | ||
} | ||
CycloneDXAffectedVexIngest = []assembler.VexIngest{ | ||
{ | ||
Pkg: pkg1, | ||
Vulnerability: vulnSpecAffected, | ||
VexData: vexDataAffected, | ||
}, | ||
{ | ||
Pkg: pkg2, | ||
Vulnerability: vulnSpecAffected, | ||
VexData: vexDataAffected, | ||
}, | ||
VexDataAffected = &generated.VexStatementInputSpec{ | ||
Status: generated.VexStatusAffected, | ||
VexJustification: generated.VexJustificationNotProvided, | ||
Statement: "Versions of Product ABC are affected by the vulnerability. Customers are advised to upgrade to the latest release.", | ||
StatusNotes: fmt.Sprintf("%s:%s", generated.VexStatusAffected, generated.VexJustificationNotProvided), | ||
KnownSince: time.Unix(0, 0), | ||
} | ||
CycloneDXAffectedVulnMetadata = []assembler.VulnMetadataIngest{ | ||
{ | ||
Vulnerability: vulnSpecAffected, | ||
Vulnerability: VulnSpecAffected, | ||
VulnMetadata: &generated.VulnerabilityMetadataInputSpec{ | ||
ScoreType: generated.VulnerabilityScoreTypeCvssv31, | ||
ScoreValue: 10, | ||
Timestamp: time.Unix(0, 0), | ||
}, | ||
}, | ||
} | ||
CycloneDXAffectedCertifyVuln = []assembler.CertifyVulnIngest{ | ||
{ | ||
Pkg: pkg1, | ||
Vulnerability: vulnSpecAffected, | ||
VulnData: &generated.ScanMetadataInput{}, | ||
}, | ||
|
||
topLevelPkg, _ = asmhelpers.PurlToPkg("pkg:guac/cdx/ABC") | ||
HasSBOMVexAffected = []assembler.HasSBOMIngest{ | ||
{ | ||
Pkg: pkg2, | ||
Vulnerability: vulnSpecAffected, | ||
VulnData: &generated.ScanMetadataInput{}, | ||
Pkg: topLevelPkg, | ||
HasSBOM: &model.HasSBOMInputSpec{ | ||
Algorithm: "sha256", | ||
Digest: "eb62836ed6339a2d57f66d2e42509718fd480a1befea83f925e918444c369114", | ||
KnownSince: parseRfc3339("2022-03-03T00:00:00Z"), | ||
}, | ||
}, | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.