-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: properly fetch modules in source mode
Loads modules using go list instead of inferring through packages. This fixes a few module-level edge cases where a vuln wouldn't be counted. Change-Id: I24e0ffa73f47451806d88aa672ca8ef7a72fc2bb Reviewed-on: https://go-review.googlesource.com/c/vuln/+/529278 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Zvonimir Pavlinovic <[email protected]>
- Loading branch information
Maceo Thompson
committed
Oct 31, 2023
1 parent
cc39747
commit 61b4508
Showing
8 changed files
with
205 additions
and
66 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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
##### | ||
# Test govulncheck runs on the subdirectory of a module | ||
$ govulncheck -C ${moddir}/vuln/subdir . --> FAIL 3 | ||
Scanning your code and P packages across M dependent module for known vulnerabilities... | ||
Scanning your code and P packages across M dependent modules for known vulnerabilities... | ||
|
||
Vulnerability #1: GO-2021-0113 | ||
Due to improper index calculation, an incorrectly formatted language tag can | ||
|
@@ -19,7 +19,7 @@ Vulnerability #1: GO-2021-0113 | |
|
||
Found 0 vulnerabilities in packages that you import, but there are no | ||
call stacks leading to the use of these vulnerabilities. You may not | ||
need to take any action. There are also 2 vulnerabilities in modules | ||
need to take any action. There are also 4 vulnerabilities in modules | ||
that you require that are neither imported nor called. | ||
See https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck for details. | ||
|
||
|
@@ -32,7 +32,24 @@ Vulnerability #1: GO-2022-0969 | |
Found in: net/[email protected] | ||
Fixed in: net/[email protected] | ||
|
||
Vulnerability #2: GO-2020-0015 | ||
Vulnerability #2: GO-2021-0265 | ||
A maliciously crafted path can cause Get and other query functions to | ||
consume excessive amounts of CPU and time. | ||
More info: https://pkg.go.dev/vuln/GO-2021-0265 | ||
Module: github.com/tidwall/gjson | ||
Found in: github.com/tidwall/[email protected] | ||
Fixed in: github.com/tidwall/[email protected] | ||
|
||
Vulnerability #3: GO-2021-0054 | ||
Due to improper bounds checking, maliciously crafted JSON objects can cause | ||
an out-of-bounds panic. If parsing user input, this may be used as a denial | ||
of service vector. | ||
More info: https://pkg.go.dev/vuln/GO-2021-0054 | ||
Module: github.com/tidwall/gjson | ||
Found in: github.com/tidwall/[email protected] | ||
Fixed in: github.com/tidwall/[email protected] | ||
|
||
Vulnerability #4: GO-2020-0015 | ||
An attacker could provide a single byte to a UTF16 decoder instantiated with | ||
UseBOM or ExpectBOM to trigger an infinite loop if the String function on | ||
the Decoder is called, or the Decoder is passed to transform.String. If used | ||
|
@@ -50,7 +67,7 @@ Share feedback at https://go.dev/s/govulncheck-feedback. | |
##### | ||
# Test govulncheck runs on the subdirectory of a module | ||
$ govulncheck -C ${moddir}/vuln/subdir -show=traces . --> FAIL 3 | ||
Scanning your code and P packages across M dependent module for known vulnerabilities... | ||
Scanning your code and P packages across M dependent modules for known vulnerabilities... | ||
|
||
Vulnerability #1: GO-2021-0113 | ||
Due to improper index calculation, an incorrectly formatted language tag can | ||
|
@@ -70,7 +87,7 @@ Vulnerability #1: GO-2021-0113 | |
|
||
Found 0 vulnerabilities in packages that you import, but there are no | ||
call stacks leading to the use of these vulnerabilities. You may not | ||
need to take any action. There are also 2 vulnerabilities in modules | ||
need to take any action. There are also 4 vulnerabilities in modules | ||
that you require that are neither imported nor called. | ||
See https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck for details. | ||
|
||
|
@@ -83,7 +100,24 @@ Vulnerability #1: GO-2022-0969 | |
Found in: net/[email protected] | ||
Fixed in: net/[email protected] | ||
|
||
Vulnerability #2: GO-2020-0015 | ||
Vulnerability #2: GO-2021-0265 | ||
A maliciously crafted path can cause Get and other query functions to | ||
consume excessive amounts of CPU and time. | ||
More info: https://pkg.go.dev/vuln/GO-2021-0265 | ||
Module: github.com/tidwall/gjson | ||
Found in: github.com/tidwall/[email protected] | ||
Fixed in: github.com/tidwall/[email protected] | ||
|
||
Vulnerability #3: GO-2021-0054 | ||
Due to improper bounds checking, maliciously crafted JSON objects can cause | ||
an out-of-bounds panic. If parsing user input, this may be used as a denial | ||
of service vector. | ||
More info: https://pkg.go.dev/vuln/GO-2021-0054 | ||
Module: github.com/tidwall/gjson | ||
Found in: github.com/tidwall/[email protected] | ||
Fixed in: github.com/tidwall/[email protected] | ||
|
||
Vulnerability #4: GO-2020-0015 | ||
An attacker could provide a single byte to a UTF16 decoder instantiated with | ||
UseBOM or ExpectBOM to trigger an infinite loop if the String function on | ||
the Decoder is called, or the Decoder is passed to transform.String. If used | ||
|
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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"config": { | ||
"protocol_version": "v0.1.0", | ||
"scanner_name": "govulncheck" | ||
} | ||
} | ||
{ | ||
"osv": { | ||
"id": "GO-0000-0001", | ||
"modified": "0001-01-01T00:00:00Z", | ||
"published": "0001-01-01T00:00:00Z", | ||
"details": "Third-party vulnerability", | ||
"affected": [ | ||
{ | ||
"package": { | ||
"name": "golang.org/vmod", | ||
"ecosystem": "" | ||
}, | ||
"ecosystem_specific": { | ||
"imports": [ | ||
{ | ||
"goos": [ | ||
"amd" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"database_specific": { | ||
"url": "https://pkg.go.dev/vuln/GO-0000-0001" | ||
} | ||
} | ||
} | ||
{ | ||
"finding": { | ||
"osv": "GO-0000-0001", | ||
"fixed_version": "v0.1.3", | ||
"trace": [ | ||
{ | ||
"module": "golang.org/vmod", | ||
"version": "v0.0.1" | ||
} | ||
] | ||
} | ||
} | ||
{ | ||
"finding": { | ||
"osv": "GO-0000-0001", | ||
"fixed_version": "v0.1.3", | ||
"trace": [ | ||
{ | ||
"module": "golang.org/vmod", | ||
"version": "v0.0.1", | ||
"package": "vmod", | ||
"function": "VulnFoo" | ||
}, | ||
{ | ||
"module": "golang.org/main", | ||
"version": "v0.0.1", | ||
"package": "main", | ||
"function": "main" | ||
} | ||
] | ||
} | ||
} | ||
{ | ||
"osv": { | ||
"id": "GO-0000-0002", | ||
"modified": "0001-01-01T00:00:00Z", | ||
"published": "0001-01-01T00:00:00Z", | ||
"details": "Third-party vulnerability", | ||
"affected": [ | ||
{ | ||
"package": { | ||
"name": "golang.org/vmod", | ||
"ecosystem": "" | ||
}, | ||
"ecosystem_specific": {} | ||
} | ||
], | ||
"database_specific": { | ||
"url": "https://pkg.go.dev/vuln/GO-0000-0002" | ||
} | ||
} | ||
} | ||
{ | ||
"finding": { | ||
"osv": "GO-0000-0002", | ||
"fixed_version": "v0.1.3", | ||
"trace": [ | ||
{ | ||
"module": "golang.org/vmod", | ||
"version": "v0.0.1" | ||
} | ||
] | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Vulnerability #1: GO-0000-0001 | ||
Third-party vulnerability | ||
More info: https://pkg.go.dev/vuln/GO-0000-0001 | ||
Module: golang.org/vmod | ||
Found in: golang.org/[email protected] | ||
Fixed in: golang.org/[email protected] | ||
Platforms: amd | ||
Example traces found: | ||
#1: main.main calls vmod.VulnFoo | ||
|
||
=== Informational === | ||
|
||
Found 0 vulnerabilities in packages that you import, but there are no | ||
call stacks leading to the use of these vulnerabilities. You may not | ||
need to take any action. There is also 1 vulnerability in modules | ||
that you require that is neither imported nor called. | ||
See https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck for details. | ||
|
||
Vulnerability #1: GO-0000-0002 | ||
Third-party vulnerability | ||
More info: https://pkg.go.dev/vuln/GO-0000-0002 | ||
Module: golang.org/vmod | ||
Found in: golang.org/[email protected] | ||
Fixed in: golang.org/[email protected] | ||
|
||
Your code is affected by 1 vulnerability from 1 module. | ||
|
||
Share feedback at https://go.dev/s/govulncheck-feedback. |
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.