security-scan

A command that audits Terraform/OpenTofu modules for cloud-security mistakes, either across the repository or within a named module. It checks credential handling and other project-specific security rules.

In plain words
What is it for?
Use it to scan `.tf` files for embedded credentials, insecure defaults, missing sensitive flags, and violations of the repository’s Azure and AWS credential rules.
Why use it?
Cloud credentials accidentally placed in configuration can expose accounts, while generic scanners may miss project conventions. This audit checks for hardcoded secrets and unsafe settings.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/techequitycloud/rad-modules/security-scan
Clone the repo
git clone --depth 1 https://github.com/techequitycloud/rad-modules

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,272 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01272
Opus 5 $0.00000 $0.00636
Sonnet 5 $0.00000 $0.00254
Haiku 4.5 $0.00000 $0.00127

Measured yesterday against content hash 0cc741fd32cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

security-scan scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/security-scan.md · 128 lines

How it starts

The opening of the file, as written. The whole thing — 128 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Run a security audit of the rad-modules repository: $ARGUMENTS

If $ARGUMENTS names a module (e.g. "Istio_GKE", "EKS_GKE"), scope all checks to that module directory. Otherwise scan every module under modules/.

This complements the Trivy config scan in CI (which catches generic misconfigurations) by checking the conventions and multi-cloud credential rules specific to rad-modules.

End with the structured summary at the bottom.


CHECK 1 — HARDCODED CLOUD CREDENTIALS

Grep all .tf files in scope for credential fields assigned a literal value: client_secret, aws_secret_key, aws_access_key, aws_secret_access_key, password, api_key, access_token, secret_key, private_key, service_account_key

Flag any assigned a quoted literal (≥8 chars). Safe forms (do NOT flag): = var. = local. = data.<...> = random_password.<...>.result = ""

Also flag any variable "<credential>" block with a non-empty hardcoded default. This is the cardinal rule: Azure (ARM_*) and AWS (AWS_*) credentials are supplied at runtime via env vars or tfvars, never baked into the module. Severity: HIGH.


CHECK 2 — SENSITIVE FLAGS

Every credential variable (client_secret, azure_tenant_id, subscription_id, client_id, aws_secret_key, aws_access_key, aws_secret_access_key, and any *_secret / *_key / password) must set sensitive = true so the value is redacted in plan output and logs. Report any that don't. Do NOT flag tenant_id — that is a resource-naming identifier (default "demo"), not a credential. Severity: MEDIUM.


CHECK 3 — SERVICE ACCOUNT & IAM LEAST PRIVILEGE

Read every .tf that creates google_project_iam_member, google_project_iam_binding, google_service_account, or grants roles (gke.tf, iam.tf, hub.tf, etc.).

For each role granted to a service account or to trusted_users, flag anything broader than needed: roles/owner — always flag (HIGH) roles/editor — always flag (HIGH) roles/iam.securityAdmin, roles/iam.serviceAccountAdmin — flag unless justified (MEDIUM) roles/container.admin — check whether roles/container.developer suffices (LOW) roles/storage.admin — check whether objectAdmin/objectViewer suffices (LOW)

Report the SA/binding, the broad role, and a narrower alternative.


CHECK 4 — IMPERSONATION SAFETY

For Pattern B modules (provider-auth.tf present): a) Both the google and google-beta providers must set impersonate_service_account = length(var.resource_creator_identity) != 0 ? var.resource_creator_identity : null, so the module still works under plain ADC when no SA is supplied. b) No provider or resource may carry a hardcoded access_token. c) No module currently mints its own token via google_service_account_access_token; if one is introduced, its lifetime must be bounded (≤ "3600s").


CHECK 5 — API ENABLEMENT INVARIANT

Every google_project_service must set disable_dependent_services = false and disable_on_destroy = false, and must not use lifecycle { prevent_destroy = true }. A destroy that disables shared APIs is a denial-of-service against co-tenant modules. Severity: HIGH (data-integrity / availability).


CHECK 6 — NETWORK EXPOSURE

a) Firewall rules (google_compute_firewall): flag any source_ranges = ["0.0.0.0/0"] opening management ports (22, 3389, 6443, 10250). Note Istio/LB ingress 80/443 is usually intentional but call it out. b) GKE clusters: check whether enable_private_nodes / a private endpoint is configured; flag clusters with a fully public control plane unless the module's purpose requires it. c) master_authorized_networks — flag clusters exposing the API server to 0.0.0.0/0.


CHECK 7 — DESTROY-PROVISIONER SAFETY

For null_resource blocks with local-exec provisioners: a) Destroy provisioners (when = destroy) should use set +e and --ignore-not-found / || echo "Warning..." so a partial state never blocks destroy. b) Triggers must capture every variable the destroy provisioner reads (only self.triggers.* is available at destroy time) — flag a destroy provisioner that references var.* directly.

Read the full file on GitHub · 128 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 128 lines · 0 tokens per session scan A 0cc741fd32cf

Subscribe to this mod's changes

security-scan is a command published in the GitHub repository techequitycloud/rad-modules (2 stars, last pushed 8d ago), licensed MPL-2.0. It costs nothing until one of its globs matches a file; then it loads 1,272 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.