Skip to content
Python

Pin trivy in the managed registry; retire tfsec from cloud-posture

Rohit C Prasadc041ed64a539
diff --git a/coworker/personas/builtin/cloud-posture/manifest.md b/coworker/personas/builtin/cloud-posture/manifest.md
index fa55f27b..dc7f2705 100644
--- a/coworker/personas/builtin/cloud-posture/manifest.md
+++ b/coworker/personas/builtin/cloud-posture/manifest.md
@@ -10,7 +10,7 @@ connectors: true
skills: [iac-scan, aws-posture]
recommended_models: [anthropic:claude-opus-4-8, openai:gpt-5.6-sol]
default_permission_mode: interactive
-description: An infrastructure-security reviewer for teams without a cloud security team. Scans Terraform and cloud configuration with open-source tools (trivy, tfsec, checkov), reads your live cloud posture strictly read-only, and fixes what matters in the IaC — never by clicking around a console.
+description: An infrastructure-security reviewer for teams without a cloud security team. Scans Terraform and cloud configuration with open-source tools (trivy, checkov), reads your live cloud posture strictly read-only, and fixes what matters in the IaC — never by clicking around a console.
recommends:
- connector: github
reason: open fix PRs for the Terraform changes
@@ -22,7 +22,7 @@ Terraform and in the live account, explain what actually matters, and fix it at
source: the code.
How you work:
-- You DRIVE scanners (trivy config / tfsec / checkov for IaC); your value is judgment —
+- You DRIVE scanners (trivy config / checkov for IaC); your value is judgment —
which findings are real exposure for THIS architecture, and what the minimal safe
change is.
- Fix in the IaC, never in the console. A console fix is drift; a Terraform fix is
diff --git a/coworker/personas/builtin/cloud-posture/skills/iac-scan/SKILL.md b/coworker/personas/builtin/cloud-posture/skills/iac-scan/SKILL.md
index 3fdcce98..b7ce13ef 100644
--- a/coworker/personas/builtin/cloud-posture/skills/iac-scan/SKILL.md
+++ b/coworker/personas/builtin/cloud-posture/skills/iac-scan/SKILL.md
@@ -1,14 +1,17 @@
---
name: iac-scan
-description: Scan Terraform/IaC with trivy or tfsec and fix what matters in code
+description: Scan Terraform/IaC with trivy config and fix what matters in code
---
Scan the repo's infrastructure-as-code and turn findings into minimal, safe Terraform
changes.
-1. Pick the scanner that's present (check in this order, ask before installing):
+1. Pick the scanner (in this order — do NOT skip the scan if none is present):
- `trivy config . --format json -o /tmp/iac.json` (also covers Dockerfiles/k8s)
- - `tfsec . --format json --out /tmp/iac.json`
- - `checkov -d . -o json > /tmp/iac.json`
+ - `checkov -d . -o json > /tmp/iac.json` if the repo already uses it
+ - Neither installed: ask for trivy with `request_tool("trivy", …)`. If the user
+ declines, review the Terraform by hand against the exposure checklist in step 2
+ and say in your report that the scan was manual.
+ Do not suggest tfsec — it is deprecated; `trivy config` is its successor.
2. Triage by real exposure, reading the surrounding Terraform for each finding:
- Internet-reachable (0.0.0.0/0 ingress, public buckets/ALBs) first.
- Then identity blast radius (wildcard IAM, broad assume-role trust).
diff --git a/coworker/toolchain.py b/coworker/toolchain.py
index c7f46136..93640ea0 100644
--- a/coworker/toolchain.py
+++ b/coworker/toolchain.py
@@ -86,8 +86,8 @@ class ManagedTool:
# own checksum manifest; bumping a tool means bumping the digest in the same commit.
#
# Not every scanner belongs here: semgrep is distributed as a Python package (pip/brew),
-# and trivy/tfsec ship per-distro packaging — for those we resolve the user's install
-# rather than half-managing a copy. That's a deliberate line, not an omission.
+# so we resolve the user's install rather than half-managing a copy. tfsec is absent on
+# purpose — it's deprecated upstream and `trivy config` is its successor.
MANAGED: dict[str, ManagedTool] = {
"gitleaks": ManagedTool(
name="gitleaks",
@@ -111,6 +111,28 @@ MANAGED: dict[str, ManagedTool] = {
),
},
),
+ "trivy": ManagedTool(
+ name="trivy",
+ version="0.74.0",
+ summary="scans IaC/config, container images, and filesystems for misconfigurations and vulnerabilities",
+ downloads={
+ "darwin_arm64": Download(
+ url="https://github.com/aquasecurity/trivy/releases/download/v0.74.0/trivy_0.74.0_macOS-ARM64.tar.gz",
+ sha256="1caada5e0e2091909357c7525d3aa76f4b660b13821bc143b190c7483e31cc11",
+ member="trivy",
+ ),
+ "darwin_amd64": Download(
+ url="https://github.com/aquasecurity/trivy/releases/download/v0.74.0/trivy_0.74.0_macOS-64bit.tar.gz",
+ sha256="472816f6888dda689d075c30254d4210b4d1035acf365aa72332f584c2f60485",
+ member="trivy",
+ ),
+ "linux_amd64": Download(
+ url="https://github.com/aquasecurity/trivy/releases/download/v0.74.0/trivy_0.74.0_Linux-64bit.tar.gz",
+ sha256="2ae6fe3ee734b7fdf11335663e18c75ea12dccc76062f09f164a3b0f8be4371a",
+ member="trivy",
+ ),
+ },
+ ),
"osv-scanner": ManagedTool(
name="osv-scanner",
version="2.5.0",
diff --git a/tests/test_security_bundles.py b/tests/test_security_bundles.py
index 7adf50cd..4007373b 100644
--- a/tests/test_security_bundles.py
+++ b/tests/test_security_bundles.py
@@ -114,6 +114,23 @@ def test_scanner_skills_offer_a_fallback_instead_of_stopping(tmp_path):
assert "REDACTED" in secret_scan
+def test_cloud_posture_drives_trivy_config_not_deprecated_tfsec(tmp_path):
+ """tfsec was folded into trivy upstream and is maintenance-only; recommending it
+ sends request_tool (and users) after a dead tool. `trivy config` is the successor.
+ The only tfsec mention allowed in the bundle is the deprecation ban itself."""
+ import coworker.personas as personas_pkg
+
+ root = Path(personas_pkg.__file__).parent / "builtin" / "cloud-posture"
+ assert "tfsec" not in (root / "manifest.md").read_text()
+
+ skill = (root / "skills" / "iac-scan" / "SKILL.md").read_text()
+ assert "trivy config" in skill
+ assert "request_tool" in skill # missing scanner → ask, never a dropped scan
+ for line in skill.splitlines():
+ if "tfsec" in line:
+ assert "deprecated" in line, f"stray tfsec mention: {line!r}"
+
+
def test_bundles_offer_a_report_page_rather_than_assuming_one(tmp_path):
"""A long findings list is a document people re-read and share, so the bundles offer a
self-contained HTML report — but ASK first (owner call 2026-08-14). Assuming it would
diff --git a/tests/test_toolchain.py b/tests/test_toolchain.py
index 638fdddf..e12d98d7 100644
--- a/tests/test_toolchain.py
+++ b/tests/test_toolchain.py
@@ -72,6 +72,16 @@ def test_registry_entries_are_pinned_and_digested():
assert dl.url.startswith("https://"), f"{name}/{key} must be https"
+def test_trivy_is_pinned_for_every_platform_we_ship():
+ """tfsec is deprecated upstream (folded into trivy); `trivy config` is the IaC scanner
+ the cloud-posture bundle drives, so its pin must exist wherever the app runs."""
+ tool = toolchain.MANAGED["trivy"]
+ assert set(tool.downloads) >= {"darwin_arm64", "darwin_amd64", "linux_amd64"}
+ for dl in tool.downloads.values():
+ assert dl.member == "trivy" # release assets are tarballs, not bare binaries
+ assert "tfsec" not in toolchain.MANAGED
+
+
def test_describe_surfaces_what_the_user_is_approving(monkeypatch):
monkeypatch.setattr(toolchain, "_platform_key", lambda: "darwin_arm64")
info = toolchain.describe("gitleaks")