-
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/scan: introduce format flag
The current values are text and json. The latter is compatible with -json flag that is designated as a legacy flag common to Go tools. This CL is a precursor to sarif support. Change-Id: I5a73b224e34c6c7f2798858c818f5f8d8e2437d0 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/564478 Run-TryBot: Zvonimir Pavlinovic <[email protected]> TryBot-Result: Gopher Robot <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Maceo Thompson <[email protected]>
- Loading branch information
1 parent
bb77557
commit 685e27b
Showing
23 changed files
with
108 additions
and
41 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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/binary-call/binary_call_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/binary-call/binary_vendored_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/binary-module/binary_module_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/binary-package/binary_package_json.ct
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,4 +1,4 @@ | ||
##### | ||
# Test of query mode with invalid input. | ||
$ govulncheck -mode=query -json example.com/module@ --> FAIL 2 | ||
$ govulncheck -mode=query -format json example.com/module@ --> FAIL 2 | ||
invalid query example.com/module@: must be of the form module@version |
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,6 +1,6 @@ | ||
##### | ||
# Test of query mode for a third party module. | ||
$ govulncheck -mode=query -json github.com/tidwall/[email protected] | ||
$ govulncheck -mode=query -format json github.com/tidwall/[email protected] | ||
{ | ||
"config": { | ||
"protocol_version": "v1.0.0", | ||
|
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,6 +1,6 @@ | ||
##### | ||
# Test of query mode with multiple inputs. | ||
$ govulncheck -mode=query -json [email protected] github.com/tidwall/[email protected] | ||
$ govulncheck -mode=query -format json [email protected] github.com/tidwall/[email protected] | ||
{ | ||
"config": { | ||
"protocol_version": "v1.0.0", | ||
|
3 changes: 1 addition & 2 deletions
3
cmd/govulncheck/testdata/testfiles/source-call/source_call_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/source-call/source_informational_text.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/source-call/source_multientry_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/source-call/source_replace_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/source-call/source_vendored_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/source-module/source_module_json.ct
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
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/source-package/source_package_json.ct
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,6 +1,6 @@ | ||
##### | ||
# Test of query mode with the standard library. | ||
$ govulncheck -mode=query -json [email protected] | ||
$ govulncheck -mode=query -format json [email protected] | ||
{ | ||
"config": { | ||
"protocol_version": "v1.0.0", | ||
|
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/stdlib/query_vstdlib_json.ct
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,6 +1,6 @@ | ||
##### | ||
# Test of query mode with the standard library (with a v prefix on the version). | ||
$ govulncheck -mode=query -json [email protected] | ||
$ govulncheck -mode=query -format json [email protected] | ||
{ | ||
"config": { | ||
"protocol_version": "v1.0.0", | ||
|
2 changes: 1 addition & 1 deletion
2
cmd/govulncheck/testdata/testfiles/stdlib/source_stdlib_json.ct
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,28 @@ | ||
##### | ||
# Test of explicit text format | ||
$ govulncheck -C ${moddir}/informational -format text . | ||
Scanning your code and P packages across M dependent modules for known vulnerabilities... | ||
|
||
=== Symbol Results === | ||
|
||
No vulnerabilities found. | ||
|
||
Your code is affected by 0 vulnerabilities. | ||
This scan also found 1 vulnerability in packages you import and 1 vulnerability | ||
in modules you require, but your code doesn't appear to call these | ||
vulnerabilities. | ||
Use '-show verbose' for more details. | ||
|
||
# Test of explicit json format | ||
$ govulncheck -C ${moddir}/informational -format json | ||
{ | ||
"config": { | ||
"protocol_version": "v1.0.0", | ||
"scanner_name": "govulncheck", | ||
"scanner_version": "v0.0.0-00000000000-20000101010101", | ||
"db": "testdata/vulndb-v1", | ||
"db_last_modified": "2023-04-03T15:57:51Z", | ||
"go_version": "go1.18", | ||
"scan_level": "symbol" | ||
} | ||
} |
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