Skip to content
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

docs: add example of creating whitelist of checks #7821

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion docs/docs/configuration/filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,25 @@ trivy image --ignore-policy contrib/example_policy/basic.rego centos:7
For more advanced use cases, there is a built-in Rego library with helper functions that you can import into your policy using: `import data.lib.trivy`.
More info about the helper functions are in the library [here](https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/pkg/result/module.go).

You can find more example checks [here](https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/pkg/result/module.go)
You can find more example checks [here](https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/contrib/example_policy).

You can also create a whitelist of checks using Rego. The policy below ignores all checks that are not allowed:

```rego
package trivy

import rego.v1

allowed_checks := {
"AVD-AWS-0089"
}

default ignore := false

ignore if not is_check_allowed

is_check_allowed if input.AVDID in allowed_checks
```

### By Vulnerability Exploitability Exchange (VEX)
| Scanner | Supported |
Expand Down