-
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): Use updated terminology for misconfiguration checks #6476
Conversation
Signed-off-by: Simar <[email protected]>
We probably have to update these flags as well: https://github.com/aquasecurity/trivy/blob/main/pkg/flag/rego_flags.go#L10-L44 |
Note: tests are failing as this will fix them. |
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.
Hello @simar7
left some comments.
Also take a look linter error, please.
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.
Left some small comments
go.mod
Outdated
@@ -1,8 +1,6 @@ | |||
module github.com/aquasecurity/trivy | |||
|
|||
go 1.22 | |||
|
|||
toolchain go1.22.0 |
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.
Hmm... what version of Go are you using on your local PC?
Why was this removed?
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'm not sure to be honest. Maybe it's redundant to specify toolchain when the go version is the same? https://go.dev/ref/mod#go-mod-file-toolchain
I run the following:
$ go version
go version go1.22.0 darwin/arm64
If you get rid of the patch version from the go directive within go.mod, I get this error:
$ go mod tidy
go: downloading go1.22 (darwin/arm64)
go: download go1.22 for darwin/arm64: toolchain not available
Running go mod tidy
on the version in main automatically removes the toolchain
directive and replaces it with this change.
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.
hm... this is strange...
my Go doesn't remove toolchain
😄 :
➜ trivy git:(main) git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
➜ trivy git:(main) go mod tidy
➜ trivy git:(main) go version
go version go1.22.2 darwin/arm64
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.
Hmm I'm taking a look again to see what's going on. I will upgrade to Go 1.22.2 as you and try again.
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.
@DmitriyLewen I don't have a good answer but after updating to go 1.22.2, go removed the toolchain directive for me but added a patch version to the go version https://github.com/aquasecurity/trivy/pull/6476/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6R3
I personally think since our go version and toolchain are same, this behavior is normal and expected as specifying the same version for the toolchain and go version are redundant. But I'm not sure why I'm not able to replicate the behavior you see on your end.
Could you try the following?
- Restore the go version from the main branch into my branch
- Try running
go mod tidy
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.
Go also applies MVS to the Go version. Since trivy-checks
uses go 1.22.0
now, Go chooses 1.22.0 rather than 1.22.
https://github.com/aquasecurity/trivy-checks/blob/55f3883e2b99a9a48a31c9db17270ab0af5b38f0/go.mod#L3
I'd suggest removing the patch version in trivy-checks. Otherwise, we need to bump the patch version every time (1.22.0 => 1.22.1 => 1.22.2...).
diff --git a/go.mod b/go.mod
index 2cf4c04..6352ca5 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/aquasecurity/trivy-checks
-go 1.22.0
+go 1.22
require (
github.com/aquasecurity/trivy v0.50.2
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.
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've just reviewed go.mod and pkg/flag
I'd like @nikpivkin to review once again when he's back. |
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
Description
This PR updates the references in the code (and the UX) to use the updated terminology of a "check".
Related issues
Related PRs
Checklist