-
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
feat(misconf): loading embedded checks as a fallback #6502
Conversation
236d6f8
to
7d044e0
Compare
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.
I just checked commands/artifact
and scanner/local
. They look good to me.
@nikpivkin one case I found was if we ever have a bad check, the fallback to embedded scenario will continue to take place until a new bundle is downloaded (which includes a fixed check). This would occur on each Trivy run. Perhaps this is acceptable. I thought about re-downloading the bundle in this case (in addition to falling back for that particular run) but I think it's complicated and error prone in other ways. Thoughts? |
@simar7 You mean re-download the previous version's bundle? Then all checks will be rolled back, including those with no errors. |
No I meant download the latest bundle available. But I think it adds complexity so let's not do it. |
var excludedFiles []string | ||
|
||
for _, e := range compiler.Errors { | ||
loc := e.Location.File |
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.
@nikpivkin @simar7 I have bump trivy-operator with latest trivy 0.51.1
and I'm getting nil pointer
exception on L152 while running my policies tests
loc := e.Location.File
anyway to protect it?
here is link for test failure
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.
Location can be nil. I'll add a check.
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.
@chen-keinan Opened the PR with a fix. #6638
Description
This PR adds functionality to fallback to embedded checks if an error occurs compiling an built-in check from a bundle.
main.tf
rm -rf ~/Library/Caches/trivy/policy
go run ./cmd/trivy conf main.tf -d --policy-bundle-repository ghcr.io/nikpivkin/trivy-policies:test
Related issues
Checklist