-
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: add a examples field to check metadata #8068
Conversation
Signed-off-by: nikpivkin <[email protected]>
@aquasecurity/trivy WDYT? |
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 think this is a nice idea, it'll simplify the metadata annotation and the example file as well.
But we have to consider the changes the consumer of the examples and metadata will need. I know AVD is one of them but there might be others.
AVD only uses markdown documentation that is generated within trivy-checks. As far as I know, there are no more consumers, so the examples are only used inside trivy-checks. |
@tamirkiviti13 as a consumer of trivy checks, do you use the checks metadata in anyway? |
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 don't see any problems that could affect Trivy users (except for a small increase in the size of the folder with checks, but the size will increase so insignificantly that it can be neglected)
OK we can merge it in for now since we haven't heard any other objections. |
Description
Previously, examples for checks were stored in separate files for each provider. For example, the examples for Terraform
<name>
checks were in the<name>.tf.go
file, and the examples for CloudFormation were in<name>.cf.go
. With the discontinuation of support for Go checks, there is no longer a need to store examples in Go files as it makes them harder to retrieve. Therefore, the examples for each check have been moved from Go to YAML with a new schema:Currently, the check metadata includes fields for each provider with the same structure:
I have an idea to convert test data for Dockerfile and Kubernetes into examples for integration testing and display on a website. (draft PR). However, the current approach when adding a new provider requires the following steps:
This process is awkward and inflexible. To simplify it, I propose to introduce a new
examples
field, which will contain the path to the file with examples to check, replacing the current fields with providers:Along with this, the structure of the example file can be updated to make it more flexible:
Checklist