-
Notifications
You must be signed in to change notification settings - Fork 18k
x/vuln: feature request: govulncheck needs a (-f json) format option to output valid JSON for CI/CD tools to make decisions on the fly #60207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I need the |
cc @golang/vulndb |
I don't think there's a bug here? this is the proper way of streaming json events, each event is its own json object, separated by newlines |
This is consistent with |
@seankhliao I see the consistency with What is the best way to write the output of |
cc @golang/vulndb, @heschi Could you please help me find a response for the last request? Thank you. |
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. Please see https://github.com/golang/go/wiki/Questions for places to ask questions. |
@heschi
If not an issue, please consider this a feature request. I will modify the issue to reflect feature request. |
govulncheck does produce json that jq can cope with as a stream of json objects, and it writes that json to stdout in a completely normal fashion.
While we and the community is normally happy to help with these kinds of problems the issue tracker is not where we have those kinds of conversations. |
When we run george@Georges-MBP goapi % govulncheck --help
Govulncheck is a tool for finding known vulnerabilities.
Usage:
...
-json
output JSON
...
...
For details, see https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck. |
@ianthehat I will try |
The output is valid json. |
@ianthehat @seankhliao Thank you for your comments. This is how I am running the command @ianthehat provided, on Docker interactive ( I just noticed it works fine when running directly on macOS (zsh/go version george@Georges-MBP goapi % docker run -it -v .:/go/src golang:latest /bin/sh
# cd /go/src
# go install golang.org/x/vuln/cmd/govulncheck@latest
go: downloading golang.org/x/vuln v0.1.0
go: downloading golang.org/x/mod v0.10.0
go: downloading golang.org/x/tools v0.8.1-0.20230421161920-b9619ee54b47
go: downloading golang.org/x/sync v0.1.0
go: downloading golang.org/x/sys v0.7.0
# govulncheck -json ./... > govuln-output.json
# cat govuln-output.json
{
"config": {
"version": "govulncheck@v0.0.0",
"data_source": "https://vuln.go.dev",
"last_modified": "2023-05-18T20:38:56Z",
"go_version": "go1.20.4"
}
}
{
"progress": {
"message": "Scanning your code and 265 packages across 30 dependent modules for known vulnerabilities..."
}
}
# go version
go version go1.20.4 linux/arm64
# uname -a
Linux 155009661e9a 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
# |
Trying to get to the bottom of the issue, I tried
|
Again, the issue tracker is not where we have these conversations. I will reply this one last time, please move this conversation somewhere else if you wish to continue it. If it only prints config and progress, it is because it found no vulnerabilities that affect your code. The report will vary with the go version, because that changes the version of the stdlib, which changes the vulnerabilies that affect it. Nothing is cut off, everything seems to be working exactly as expected. |
What version of Go are you using (
go version
)?Does this issue reproduce at the latest version of golang.org/x/vuln?
Yes, I installed it using
go install golang.org/x/vuln/cmd/govulncheck@latest
.govulncheck
does not have agovulncheck -v
command to confirm.What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
A full output of the
govulncheck -json ./...
command with the vulnerabilities listed in proper JSON format.What did you see instead?
Bunch of JSON objects serialized to
stdout
with interrupts such that the>
could not write complete output to file. I tried other options to write the complete file using2>&1 | tee
, still no luck.The text was updated successfully, but these errors were encountered: