-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/report: make check for Go CNA more robust in cve-to-report
Instead of checking if the CVE is for a first party module, check directly who assigned the CVE. That way we can decide correctly when to populate "cve_metadata" vs. "cves". Change-Id: Ic2ff5fbf0f380b2ae77decc290a341c888624e97 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/547976 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Damien Neil <[email protected]>
- Loading branch information
Showing
15 changed files
with
53 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,22 +81,30 @@ func cveToReport(c *cveschema.CVE, id, modulePath string) *Report { | |
Credits: credits, | ||
References: refs, | ||
} | ||
r.addCVE(c.Metadata.ID, modulePath) | ||
r.addCVE(c.Metadata.ID, getCWE(c), isGoCNA(c)) | ||
return r | ||
} | ||
|
||
func (r *Report) addCVE(cveID, modulePath string) { | ||
// New standard library and x/ repo CVEs are likely maintained by | ||
// the Go CNA. | ||
if stdlib.IsStdModule(modulePath) || stdlib.IsCmdModule(modulePath) || | ||
stdlib.IsXModule(modulePath) { | ||
func getCWE(c *cveschema.CVE) string { | ||
if len(c.ProblemType.Data) == 0 || len(c.ProblemType.Data[0].Description) == 0 { | ||
return "" | ||
} | ||
return c.ProblemType.Data[0].Description[0].Value | ||
} | ||
|
||
func isGoCNA(c *cveschema.CVE) bool { | ||
return c.Assigner == "[email protected]" | ||
} | ||
|
||
func (r *Report) addCVE(cveID, cwe string, isGoCNA bool) { | ||
if isGoCNA { | ||
r.CVEMetadata = &CVEMeta{ | ||
ID: cveID, | ||
CWE: "TODO", | ||
CWE: cwe, | ||
} | ||
} else { | ||
r.CVEs = append(r.CVEs, cveID) | ||
return | ||
} | ||
r.CVEs = append(r.CVEs, cveID) | ||
} | ||
|
||
func CVE5ToReport(c *cveschema5.CVERecord, id, modulePath string, pc *proxy.Client) *Report { | ||
|
@@ -163,6 +171,17 @@ func cve5ToReport(c *cveschema5.CVERecord, id, modulePath string) *Report { | |
References: refs, | ||
} | ||
|
||
r.addCVE(c.Metadata.ID, modulePath) | ||
r.addCVE(c.Metadata.ID, getCWE5(&cna), isGoCNA5(&cna)) | ||
return r | ||
} | ||
|
||
func getCWE5(c *cveschema5.CNAPublishedContainer) string { | ||
if len(c.ProblemTypes) == 0 || len(c.ProblemTypes[0].Descriptions) == 0 { | ||
return "" | ||
} | ||
return c.ProblemTypes[0].Descriptions[0].Description | ||
} | ||
|
||
func isGoCNA5(c *cveschema5.CNAPublishedContainer) bool { | ||
return c.ProviderMetadata.OrgID == GoOrgUUID | ||
} |
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 |
---|---|---|
|
@@ -12,11 +12,10 @@ modules: | |
- package: archive/zip | ||
description: | | ||
archive/zip in Go 1.16.x before 1.16.1 allows attackers to cause a denial of service (panic) upon attempted use of the Reader.Open API for a ZIP archive in which ../ occurs at the beginning of any filename. | ||
cves: | ||
- CVE-2021-27919 | ||
references: | ||
- web: https://groups.google.com/g/golang-announce/c/MfiLYjG-RAw | ||
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/2MU47VKTNXX33ZDLTI2ORRUY3KLJKU6G/ | ||
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/HM7U5JNS5WU66Q3S26PFIU2ITB2ATTQ4/ | ||
- web: https://security.gentoo.org/glsa/202208-02 | ||
cve_metadata: | ||
id: CVE-2021-27919 | ||
cwe: TODO |
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 |
---|---|---|
|
@@ -12,12 +12,11 @@ modules: | |
- package: cmd/go | ||
description: | | ||
Go before 1.14.14 and 1.15.x before 1.15.7 on Windows is vulnerable to Command Injection and remote code execution when using the "go get" command to fetch modules that make use of cgo (for example, cgo can execute a gcc program from an untrusted download). | ||
cves: | ||
- CVE-2021-3115 | ||
references: | ||
- web: https://groups.google.com/g/golang-announce/c/mperVMGa98w | ||
- web: https://blog.golang.org/path-security | ||
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/YWAYJGXWC232SG3UR3TR574E6BP3OSQQ/ | ||
- web: https://security.netapp.com/advisory/ntap-20210219-0001/ | ||
- web: https://security.gentoo.org/glsa/202208-02 | ||
cve_metadata: | ||
id: CVE-2021-3115 | ||
cwe: TODO |
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 |
---|---|---|
|
@@ -25,4 +25,4 @@ references: | |
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/XZTEP6JYILRBNDTNWTEQ5D4QUUVQBESK/ | ||
cve_metadata: | ||
id: CVE-2023-29407 | ||
cwe: TODO | ||
cwe: 'CWE-834: Excessive Iteration' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,10 @@ modules: | |
- package: archive/zip | ||
description: | | ||
archive/zip in Go 1.16.x before 1.16.1 allows attackers to cause a denial of service (panic) upon attempted use of the Reader.Open API for a ZIP archive in which ../ occurs at the beginning of any filename. | ||
cves: | ||
- CVE-2021-27919 | ||
references: | ||
- web: https://groups.google.com/g/golang-announce/c/MfiLYjG-RAw | ||
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/2MU47VKTNXX33ZDLTI2ORRUY3KLJKU6G/ | ||
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/HM7U5JNS5WU66Q3S26PFIU2ITB2ATTQ4/ | ||
- web: https://security.gentoo.org/glsa/202208-02 | ||
cve_metadata: | ||
id: CVE-2021-27919 | ||
cwe: TODO |
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 |
---|---|---|
|
@@ -12,12 +12,11 @@ modules: | |
- package: cmd/go | ||
description: | | ||
Go before 1.14.14 and 1.15.x before 1.15.7 on Windows is vulnerable to Command Injection and remote code execution when using the "go get" command to fetch modules that make use of cgo (for example, cgo can execute a gcc program from an untrusted download). | ||
cves: | ||
- CVE-2021-3115 | ||
references: | ||
- web: https://groups.google.com/g/golang-announce/c/mperVMGa98w | ||
- web: https://blog.golang.org/path-security | ||
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/YWAYJGXWC232SG3UR3TR574E6BP3OSQQ/ | ||
- web: https://security.netapp.com/advisory/ntap-20210219-0001/ | ||
- web: https://security.gentoo.org/glsa/202208-02 | ||
cve_metadata: | ||
id: CVE-2021-3115 | ||
cwe: TODO |
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 |
---|---|---|
|
@@ -22,4 +22,4 @@ references: | |
- web: https://lists.fedoraproject.org/archives/list/[email protected]/message/XZTEP6JYILRBNDTNWTEQ5D4QUUVQBESK/ | ||
cve_metadata: | ||
id: CVE-2023-29407 | ||
cwe: TODO | ||
cwe: 'CWE-834: Excessive Iteration' |
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