Conftest
$ conftest Foundation Low Riskconftest brings Open Policy Agent (OPA) Rego policies to structured config files including Kubernetes manifests, Terraform plan JSON, Dockerfiles, TOML, and HCL. It runs cleanly offline, exits non-zero on policy violations, and outputs structured results via --output json.
brew install conftest Local config policy gatekeeper; conftest test -o json runs directly on repo files without MCP overhead.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports --output json (-o json), --no-color, non-zero exit codes on deny, and stdin piping (conftest test -).
- Native
-o json/--output jsonand--no-colorflags - Supports stdin (
-) and multiple config parsers automatically
Read-only policy evaluator by default; only writes locally if conftest pull downloads an OCI policy bundle.
- Read-only
testandverifycommands with zero cloud side effects
Single static Go binary available via Homebrew, Go, and GitHub Releases on macOS, Linux, and Windows.
- Single static Go binary with built-in multi-format parsers
Parses YAML, JSON, HCL, Dockerfile, TOML, and XML natively so agents do not need separate converters before running OPA.
- Auto-detects 15+ config formats for Rego validation
Hosted under the open-policy-agent GitHub organization with Apache-2.0 license.
- Maintained under
open-policy-agent/conftest
Concise official docs at conftest.dev with examples for Terraform, Kubernetes, and Dockerfiles.
- Documented CLI flags and parser matrix at conftest.dev
Security, Auth & Guardrails
No authentication required for local policy testing; pulling OCI policy bundles honors standard Docker/OCI credential helpers.
Apache-2.0 open-source project under Open Policy Agent; free to use.
# Conftest Agent Rules - Always pass `--output json` (`-o json`) and `--no-color` when parsing violations. - Avoid `conftest pull` from untrusted OCI registries without verifying policy bundle digests. - Use `conftest verify -p policy/` after editing Rego policy rules.
Agent-Ready Command Recipes
Safe Read-Only Queries
conftest test deploy.yaml -p policy/ --output json
Evaluates Rego deny/warn rules against deploy.yaml and emits structured JSON findings.
conftest verify -p policy/ --output json
Runs unit tests inside policy/ without modifying any configuration files.
Strengths for Agents
- + Built-in parsers for YAML, HCL, Dockerfile, JSON, and TOML feed directly into Rego.
- + Clean
--output jsonand--no-colorsupport with clear pass/fail exit codes. - + Supports stdin piping (
terraform show -json tfplan | conftest test -).
Caveats & Pitfalls
- ! Errors from non-standard YAML/HCL files can sometimes require explicit
--parseroverrides. - ! Requires
deny/violationrules written in Rego; ships no built-in default ruleset.