-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
chore: add VEX document and generator for Trivy #7128
Conversation
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Why is the file |
Yeah, it's better to put it in magefiles. I didn't mean to commit this file at the beginning, and I found some issues in govuncheck. After all, the script is not small anymore and I committed it. I didn't carefully think about the script. I'll move it. |
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Moved |
magefiles/vex.go
Outdated
Author: "Aqua Security", | ||
Timestamp: lo.ToPtr(time.Now()), | ||
Version: doc.Version + 1, | ||
Tooling: "https://github.com/aquasecurity/trivy/tree/main/misc/vex/vex.go", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be updated
Tooling: "https://github.com/aquasecurity/trivy/tree/main/misc/vex/vex.go", | |
Tooling: "https://github.com/aquasecurity/trivy/tree/main/magefiles/vex.go", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I also updated the field in the VEX file. @id
should be re-calculated technically, but I believe it doesn't matter.
edfc903
Co-authored-by: Nikita Pivkin <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
func VEX(_ context.Context, dir string) error { | ||
return sh.RunWith(ENV, "go", "run", "-tags=mage_vex", "./magefiles/vex.go", "--dir", dir) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about output
flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need the output flag because the VEX file should be written under .vex/
. I added it for local debugging, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All arguments are mandatory and must be specified in the order they appear in the function.
All arguments are mandatory in Mage.
https://magefile.org/targets/
It means we have to specify .vex/vex.json
every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]> Co-authored-by: Nikita Pivkin <[email protected]>
Overview
This PR introduces an OpenVEX generator for Trivy. This tool generates OpenVEX with govulnchedk to reduce false positives in vulnerability scanning by explicitly declaring "not_affected" statements for vulnerabilities that do not impact Trivy.
Key Features
I chose v0.40.0, not for any particular reason, but because it is old enough that I thought many users would be using a newer version than that.
Implementation Details
Addressing govulncheck Limitations
The current version of govulncheck (v1.1.2) has some limitations:
To overcome these issues, our script:
govulncheck -format json
) in conjunction with OpenVEX to gather additional data, such as subcomponentsThis will improve as more features are added to govulncheck.
Optimization Strategy
While it's possible for a vulnerability to be "affected" in one version and "not_affected" in another, let's say Trivy v0.50.0 uses a vulnerable function,
Solver.Solve
inmoby/buildkit
, but stop using the function in v0.51.0, I assume this is relatively rare. Therefore, for vulnerabilities that are "not_affected" and "fixed" across all versions from v0.40.0 onwards, we declare them as "not_affected" for all Trivy versions by omitting the version in the product PURL. The product ID would bepkg:golang/github.com/aquasecurity/trivy
rather than ``pkg:golang/github.com/aquasecurity/[email protected]`.Please refer to the committed OpenVEX file in this PR for concrete examples of the generated output.
Next Steps
Checklist