Skip to content

Commit 5d9f62b

Browse files
author
Maceo Thompson
committed
internal/scan: add scan_level to text tests
This change adds scan_level to the config of the json input to the textHandler tests. This more closely mirrors the actual JSON that the govulncheck text handler receives. Change-Id: Ie7438572dffe75cb3c1e94b40c3fbc8a27715755 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/545637 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
1 parent a5e767d commit 5d9f62b

9 files changed

+27
-41
lines changed

internal/scan/testdata/module-vuln.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "module"
56
}
67
}
78
{

internal/scan/testdata/multi-stack-modlevel.json

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "module"
56
}
67
}
78
{
@@ -44,26 +45,6 @@
4445
]
4546
}
4647
}
47-
{
48-
"finding": {
49-
"osv": "GO-0000-0001",
50-
"fixed_version": "v0.1.3",
51-
"trace": [
52-
{
53-
"module": "golang.org/vmod",
54-
"version": "v0.0.1",
55-
"package": "vmod",
56-
"function": "VulnFoo"
57-
},
58-
{
59-
"module": "golang.org/main",
60-
"version": "v0.0.1",
61-
"package": "main",
62-
"function": "main"
63-
}
64-
]
65-
}
66-
}
6748
{
6849
"osv": {
6950
"id": "GO-0000-0002",
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
Vulnerability #1: GO-0000-0001
2-
Third-party vulnerability
3-
More info: https://pkg.go.dev/vuln/GO-0000-0001
4-
Module: golang.org/vmod
5-
Found in: golang.org/vmod@v0.0.1
6-
Fixed in: golang.org/vmod@v0.1.3
7-
Platforms: amd
8-
Example traces found:
9-
#1: main.main calls vmod.VulnFoo
10-
111
=== Informational ===
122

13-
There is 1 vulnerability in modules that you require that is neither
14-
imported nor called. You may not need to take any action.
3+
There are 2 vulnerabilities in modules that you require that are
4+
neither imported nor called. You may not need to take any action.
155
See https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck for details.
166

177
Vulnerability #1: GO-0000-0002
@@ -21,6 +11,14 @@ Vulnerability #1: GO-0000-0002
2111
Found in: golang.org/vmod@v0.0.1
2212
Fixed in: golang.org/vmod@v0.1.3
2313

24-
Your code is affected by 1 vulnerability from 1 module.
14+
Vulnerability #2: GO-0000-0001
15+
Third-party vulnerability
16+
More info: https://pkg.go.dev/vuln/GO-0000-0001
17+
Module: golang.org/vmod
18+
Found in: golang.org/vmod@v0.0.1
19+
Fixed in: golang.org/vmod@v0.1.3
20+
Platforms: amd
21+
22+
No vulnerabilities found.
2523

2624
Share feedback at https://go.dev/s/govulncheck-feedback.

internal/scan/testdata/platform-all.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "symbol"
56
}
67
}
78
{

internal/scan/testdata/platform-one-arch-only.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "symbol"
56
}
67
}
78
{

internal/scan/testdata/platform-one-import.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "symbol"
56
}
67
}
78
{

internal/scan/testdata/platform-two-imports.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "symbol"
56
}
67
}
78
{

internal/scan/testdata/platform-two-os-only.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "symbol"
56
}
67
}
78
{

internal/scan/testdata/source.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"config": {
33
"protocol_version": "v0.1.0",
4-
"scanner_name": "govulncheck"
4+
"scanner_name": "govulncheck",
5+
"scan_level": "symbol"
56
}
67
}
78
{

0 commit comments

Comments
 (0)