vs Conftest

Conftest is a really nice tool to help you write tests against structured configuration data. Misconfiguration detection in Trivy is heavily inspired by Conftest and provides similar features Conftest has. This section describes the differences between Trivy and Conftest.

FeatureTrivyConftest
Support Rego Languagevs Conftest - 图1vs Conftest - 图2
Built-in Policiesvs Conftest - 图3vs Conftest - 图4
Custom Policiesvs Conftest - 图5vs Conftest - 图6
Custom Datavs Conftest - 图7vs Conftest - 图8
Combinevs Conftest - 图9vs Conftest - 图10
Combine per Policyvs Conftest - 图11vs Conftest - 图12
Policy Input Selector1vs Conftest - 图13vs Conftest - 图14
Policy Metadata2vs Conftest - 图15vs Conftest - 图163
Filtering by Severityvs Conftest - 图17vs Conftest - 图18
Rule-based Exceptionsvs Conftest - 图19vs Conftest - 图20
Namespace-based Exceptionsvs Conftest - 图21vs Conftest - 图22
Sharing Policiesvs Conftest - 图23vs Conftest - 图24
Show Successesvs Conftest - 图25vs Conftest - 图26
Flexible Exit Codevs Conftest - 图27vs Conftest - 图28
Rego Unit Testsvs Conftest - 图294vs Conftest - 图30
Go Testingvs Conftest - 图31vs Conftest - 图32
Verbose Tracevs Conftest - 图33vs Conftest - 图34
Supported Formats6 formats514 formats6

Trivy offers built-in policies and a variety of options, while Conftest only supports custom policies. In other words, Conftest is simpler and lighter.

Conftest is a general testing tool for configuration files, and Trivy is more security-focused. People who need an out-of-the-box misconfiguration scanner should use Trivy. People who don’t need built-in policies and write your policies should use Conftest.


  1. Pass only the types of configuration file as input, specified in selector

  2. To enrich the results such as ID, Title, Description, etc.

  3. Conftest supports structured errors in rules, but they are free format and not natively supported by Conftest.

  4. Trivy is not able to run *_test.rego like conftest verify.

  5. Dockerfile, HCL, HCL2, JSON, TOML, and YAML

  6. CUE, Dockerfile, EDN, HCL, HCL2, HOCON, Ignore files, INI, JSON, Jsonnet, TOML, VCL, XML, and YAML