-
Notifications
You must be signed in to change notification settings - Fork 18k
x/vuln: make progress-like output opt-in for -json flag #60497
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
CC @golang/vulndb |
Are there any particular tools you have in mind? All the existing tools that we were thinking about handle json streams, and if you are writing a new tool we provide some very simple code to handle it. |
Maybe "tools" was not the correct word. You are right
This would produce error One could use That's why I'm saying having some kind of "wrapper" struct over all of this would solve the problem because I could read everything and then focus on the field that I'm most interested. Right now, there are options to deal with it, like |
Another thing, is that even if you are relaying on |
To list all findings you need to do |
Easy is not really the goal of the format, powerful and flexible for writing tools on top of it is. |
As I agree with this statement, I don't fully understand how this applies to my proposal. Could you give me some use-case when the streaming format is more "powerful and flexible" comparing to my static definition? Also not sure if this is good comparison in the first place since they have their different purposes. Also, as I mentioned, I don't really want to drop the streaming, I just want to add an option to disable it.
But could be less :D Also, you already have |
Streaming is useful for cases where the scanning is going to take a long time. |
I see that you have pretty strong opinion about that, so I guess then this enhancement proposal is not going to happen :( |
What version of Go are you using (
go version
)?Does this issue reproduce at the latest version of golang.org/x/vuln?
Yes
What did you do?
govulncheck -json
What did you expect to see?
Currently, the nature of
-json
flag is that it emits progress-like output. This is extremely hard to parse by other tools, because many of them don't support multiple JSON objects defined one after another. I think the progress-like output should be opt-in instead of default value (at least for-json
flag). I feel like this would improve handling certain scenario.To give concrete example is that I would envision using job where I run
govulncheck -json > vulns.json
and then pass thisvulns.json
artifact file to next job that would do something with it. But then this other job would need to parse and omit all the objects which don't match certain structure. For example it is obsolete to parse:because this is not related to the vulnerabilities itself.
What did you see instead?
I would like to see just one structure that could be parsed and is emitted after all the checks/passes are done. For example instead of:
do:
The text was updated successfully, but these errors were encountered: