mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 07:10:41 -08:00
* feat(cli): add --filter option * feat(opa): support OPA * test(opa): add a test case with OPA * test: update a mock * chore(mod): update dependencies * chore(filter): add example Rego files * chore(README): update * chore(rego): apply opa fmt * refactor: replace filter with policy * chore(policy): update rego files * fix(vulnerability): evaluate each vulnerability * chore(README): update * Update README.md Co-authored-by: Itay Shakury <itay@itaysk.com> * Update README.md Co-authored-by: Itay Shakury <itay@itaysk.com> * chore(README): update a TOC link * fix: replace allow with ignore * chore(README): update Co-authored-by: Itay Shakury <itay@itaysk.com>
46 lines
927 B
Rego
46 lines
927 B
Rego
package trivy
|
|
|
|
import data.lib.trivy
|
|
|
|
default ignore = false
|
|
|
|
ignore_pkgs := {"bash", "bind-license", "rpm", "vim", "vim-minimal"}
|
|
|
|
ignore_severities := {"LOW", "MEDIUM"}
|
|
|
|
nvd_v3_vector = v {
|
|
v := input.CVSS.nvd.v3
|
|
}
|
|
|
|
ignore {
|
|
input.PkgName == ignore_pkgs[_]
|
|
}
|
|
|
|
ignore {
|
|
input.Severity == ignore_severities[_]
|
|
}
|
|
|
|
# Ignore a vulnerability which is not remotely exploitable
|
|
ignore {
|
|
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
|
|
cvss_vector.AttackVector != "Network"
|
|
}
|
|
|
|
# Ignore a vulnerability which requires high privilege
|
|
ignore {
|
|
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
|
|
cvss_vector.PrivilegesRequired == "High"
|
|
}
|
|
|
|
# Ignore a vulnerability which requires user interaction
|
|
ignore {
|
|
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
|
|
cvss_vector.UserInteraction == "Required"
|
|
}
|
|
|
|
# Ignore CSRF
|
|
ignore {
|
|
# https://cwe.mitre.org/data/definitions/352.html
|
|
input.CweIDs[_] == "CWE-352"
|
|
}
|