Skip to content

Commit e5d28b9

Browse files
committed
internal/report: strip the major version from module path when fixing summary
It is not always clear which major version is best to list in the summary, so just pick the base module if we are automatically creating the summary. (For REVIEWED reports, the triager can pick the best major version). Change-Id: Ifee6380136f59e9a67ef31734b0e00986340fe6d Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/600478 Reviewed-by: Damien Neil <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 502a9e4 commit e5d28b9

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

internal/cve4/testdata/cve/TestToReport/CVE-2023-45286.txtar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ modules:
3333
vulnerable_at: 2.13.1
3434
packages:
3535
- package: github.com/go-resty/resty/v2
36-
summary: CVE-2023-45286 in github.com/go-resty/resty/v2
36+
summary: CVE-2023-45286 in github.com/go-resty/resty
3737
description: |-
3838
A race condition in go-resty can result in HTTP request body disclosure across
3939
requests. This condition can be triggered by calling sync.Pool.Put with the same

internal/cve5/testdata/cve/TestToReport/CVE-2024-21527.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ modules:
1313
versions:
1414
- fixed: 8.1.0
1515
vulnerable_at: 8.0.3
16-
summary: CVE-2024-21527 in github.com/gotenberg/gotenberg/v7
16+
summary: CVE-2024-21527 in github.com/gotenberg/gotenberg
1717
cves:
1818
- CVE-2024-21527
1919
credits:
@@ -51,7 +51,7 @@ modules:
5151
vulnerable_at: 8.0.3
5252
packages:
5353
- package: github.com/gotenberg/gotenberg/v8/pkg/modules/webhook
54-
summary: CVE-2024-21527 in github.com/gotenberg/gotenberg/v8
54+
summary: CVE-2024-21527 in github.com/gotenberg/gotenberg
5555
description: |-
5656
Versions of the package github.com/gotenberg/gotenberg/v8/pkg/gotenberg before
5757
8.1.0; versions of the package

internal/genericosv/testdata/yaml/GHSA-m99c-q26r-m7m7_REVIEWED.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ modules:
1010
vulnerable_at: 13.0.2
1111
packages:
1212
- package: github.com/evmos/evmos/v13/x/vesting
13-
summary: Evmos vulnerable to unauthorized account creation with vesting module in github.com/evmos/evmos/v13
13+
summary: Evmos vulnerable to unauthorized account creation with vesting module in github.com/evmos/evmos
1414
description: |-
1515
### Impact _What kind of vulnerability is it? Who is impacted?_
1616

internal/genericosv/testdata/yaml/GHSA-v6rw-hhgg-wc4x_REVIEWED.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ modules:
66
versions:
77
- fixed: 12.0.0
88
vulnerable_at: 12.0.0-rc4
9-
summary: Evmos vulnerable to DOS and transaction fee expropriation through Authz exploit in github.com/evmos/evmos/v11
9+
summary: Evmos vulnerable to DOS and transaction fee expropriation through Authz exploit in github.com/evmos/evmos
1010
description: |-
1111
## Impact _What kind of vulnerability is it? Who is impacted?_
1212

internal/report/fix.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ func (r *Report) fixSummary() {
5858

5959
// Add a path if one exists and is needed.
6060
if paths := r.nonStdPaths(); len(paths) > 0 && !containsPath(summary, paths) {
61-
summary = fmt.Sprintf("%s in %s", summary, paths[0])
61+
summary = fmt.Sprintf("%s in %s", summary, stripMajor(paths[0]))
6262
}
6363

6464
r.Summary = Summary(fixSpelling(summary))
6565
}
6666

67+
func stripMajor(path string) string {
68+
base, _, ok := module.SplitPathVersion(path)
69+
if !ok {
70+
return path
71+
}
72+
return base
73+
}
74+
6775
func (v *Version) commitHashToVersion(modulePath string, pc *proxy.Client) {
6876
if v == nil {
6977
return

0 commit comments

Comments
 (0)