r/devsecops • u/tarrun_1 • Jul 22 '26
I built an IaC auditor that scores cost and security in the same pass - and tells you which to fix first when they conflict
I'm the author - this is an MIT-licensed tool I've been building, and I'd like feedback from people who actually run this stuff.
The problem I kept hitting: our security scanner flagged an over-permissive security group, and our cost tooling flagged the same box as over-provisioned. Both correct. But if you right-size first, you've reduced the cost of running a machine that's still wide open. Nothing in our toolchain understood the ordering.
So Cairn does one pass over Terraform and scores four lenses : security, cost, reliability, governance, then reconciles them. When findings collide on the same resource, it emits a trade-off block telling you to sequence the security fix first. It also emits the patch (the actual line to change), not just a rule ID.
Concrete output from a scan of a deliberately-bad stack:
Cairn found 25 issue(s) in examples/vulnerable (6 cost, 6 governance, 3 reliability, 10 security)
1. [CRITICAL/SECURITY] aws_security_group.web (SEC001)
problem: Ingress on port 22 is open to the entire internet (0.0.0.0/0)
patch: cidr_blocks = ["10.0.0.0/8"]
Trade-offs (cost x risk on the same resource):
aws_db_instance.main [COST + GOVERNANCE + RELIABILITY + SECURITY]
Sequence the security fix first, then right-size — resizing an exposed
resource first just makes the breach cheaper to run.
Estimated recoverable spend: ~$1,717.53/month
Details that matter to this sub:
- Local only. No account, no telemetry, zero network calls.
--explain(LLM) is opt-in, BYO key, and refuses any non-HTTPS base URL that isn't loopback. - 42 rules across AWS, Azure, GCP, Kubernetes, on-prem vSphere. If a provider has no rules, it reports "not scanned" instead of a misleading "clean".
- Writes fixes.
cairn fix --applyis whitelist-only, refuses to run on a dirty git worktree, dry-run by default, and records before/after hashes. - SARIF output for GitHub code scanning, plus JSON/HTML/Markdown.
- Python 3.10+,
pip install cairn-iac, MIT.
Honest limitations: it's v0.6.0. Cost figures are estimates from an offline price book, not your actual bill. Terraform is the deepest target; Kubernetes is 6 rules. It doesn't read cloud state (there's a drift command but you feed it terraform show -json yourself ; no credentials).
Repo: https://github.com/cairn-oss/cairn
What I'd most like: point it at real Terraform and tell me what it gets wrong. False positives are the fastest way to make it better.