Skip to content

Adding whitelist for policy #7814

Answered by nikpivkin
DanielCastronovo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @DanielCastronovo !

You can use Rego to create a whitelist of checks. The rule below ignores all checks that are not allowed.

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

Output:

trivy conf main.tf --ignore-policy whitelist.rego
2024-10-29T21:03:35+06:00       INFO    [misconfig] Misconfiguration scanning is enabled
2024-10-29T21:03:36+06:00       INFO    [terraform scanner] Scanning root module        file_path="."
2024-10-29T21:03:36+06:00       INFO    Detected config files   num=2

main.tf (terraform)

Tests: 9 (SUCCESSES: 0, FAILURES: 1, EXCEPTIONS: …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by simar7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning target/filesystem Issues relating to filesystem scanning
2 participants