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>
This commit is contained in:
Maceo Thompson 2023-11-28 15:21:23 -05:00
Родитель a5e767d85a
Коммит 5d9f62b9ff
9 изменённых файлов: 27 добавлений и 41 удалений

3
internal/scan/testdata/module-vuln.json поставляемый
Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "module"
}
}
{

Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "module"
}
}
{
@ -44,26 +45,6 @@
]
}
}
{
"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",

Просмотреть файл

@ -1,17 +1,7 @@
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/vmod@v0.0.1
Fixed in: golang.org/vmod@v0.1.3
Platforms: amd
Example traces found:
#1: main.main calls vmod.VulnFoo
=== Informational ===
There is 1 vulnerability in modules that you require that is neither
imported nor called. You may not need to take any action.
There are 2 vulnerabilities in modules that you require that are
neither imported nor called. You may not need to take any action.
See https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck for details.
Vulnerability #1: GO-0000-0002
@ -21,6 +11,14 @@ Vulnerability #1: GO-0000-0002
Found in: golang.org/vmod@v0.0.1
Fixed in: golang.org/vmod@v0.1.3
Your code is affected by 1 vulnerability from 1 module.
Vulnerability #2: GO-0000-0001
Third-party vulnerability
More info: https://pkg.go.dev/vuln/GO-0000-0001
Module: golang.org/vmod
Found in: golang.org/vmod@v0.0.1
Fixed in: golang.org/vmod@v0.1.3
Platforms: amd
No vulnerabilities found.
Share feedback at https://go.dev/s/govulncheck-feedback.

3
internal/scan/testdata/platform-all.json поставляемый
Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "symbol"
}
}
{

Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "symbol"
}
}
{

Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "symbol"
}
}
{

Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "symbol"
}
}
{

Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "symbol"
}
}
{

3
internal/scan/testdata/source.json поставляемый
Просмотреть файл

@ -1,7 +1,8 @@
{
"config": {
"protocol_version": "v0.1.0",
"scanner_name": "govulncheck"
"scanner_name": "govulncheck",
"scan_level": "symbol"
}
}
{