agentleFS
senayktsenaykt/iac-security-scan-skills/AGENTS.md

iac-security-scan-skills

AGENTS.md48 starsChanged 6 months agoMITView on GitHub

AI-powered infrastructure-as-code security assessment. Detects privilege escalation paths, internet exposure, secrets leaks, logging blind spots, serverless attack surfaces, and chained attack paths across AWS Terraform and CloudFormation codebases. The assessment runs in three steps: The iac-analysis skill maps the full repository: technology stack, environments, resource inventory, architecture patterns, internet exposure points, trust boundaries, and cross-account relationships. It writes its findings to iac-scan/analysis.md, including a File Routing table that maps each IaC file to the downstream skills that need it. All…

  • Reads credentials

The file

We split this AGENTS.md into the rules it gives an agent

11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read this file to understand the workflow

    line 43
  2. Very specific:

    Create the iac-scan/ output directory

    line 44
  3. Very specific:

    If iac-scan/ already has results from a previous scan, skip Steps 1 and 2:

    line 62
  4. Distinctive:

    When running an individual skill:

    line 136
  5. Very specific:

    If iac-scan/analysis.md already exists, reuse it (skip Step 1).

    line 137
  6. Distinctive:

    No report is generated unless explicitly requested.

    line 140
  7. Very specific:

    Skill relevance: After Step 1 completes, read the Recommended Skills table in iac-scan/analysis.md.

    line 145
  8. Very specific:

    Confidence scoring: Every finding includes a confidence score (0.0–1.0).

    line 154
  9. Very specific:

    Run only the specified domain skills (plus Step 1 analysis).

    line 168
  10. Distinctive:

    When running a scoped scan:

    line 172
  11. Distinctive:

    Only the listed domain skills run in Step 2.

    line 174

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

IaC Security Scanner

AI-powered infrastructure-as-code security assessment. Detects privilege escalation paths, internet exposure, secrets leaks, logging blind spots, serverless attack surfaces, and chained attack paths across AWS Terraform and CloudFormation codebases.

How It Works

The assessment runs in three steps:

Step 1 — Codebase Analysis

The iac-analysis skill maps the full repository: technology stack, environments, resource inventory, architecture patterns, internet exposure points, trust boundaries, and cross-account relationships. It writes its findings to iac-scan/analysis.md, including a File Routing table that maps each IaC file to the downstream skills that need it.

Step 2 — Security Analysis (parallel)

All 6 security analysis skills run in parallel as subagents. Each skill receives only the IaC files routed to it by the File Routing table in iac-scan/analysis.md, plus the analysis context. Each skill follows a multi-pass approach: first discovery/enumeration, then contextual reasoning, then attack path construction.

SkillFocusOutput
iac-iamIAM policies, privilege escalation, trust chains, PassRole abuse, cross-account trustiac-scan/iam-results.md
iac-networkVPC topology, security groups, public exposure, segmentation, egress analysisiac-scan/network-results.md
iac-storageS3 buckets, RDS/DynamoDB, encryption, backup/DR, data classification, ransomware readinessiac-scan/storage-results.md
iac-secretsHardcoded credentials, state file risks, CI/CD secret exposure, env var secretsiac-scan/secrets-results.md
iac-logging-monitoringCloudTrail gaps, GuardDuty coverage, detection blind spots, forensic readinessiac-scan/logging-monitoring-results.md
iac-serverlessLambda exposure, API Gateway auth, event injection, denial-of-wallet, Function URLsiac-scan/serverless-results.md

Step 2.5 — Attack Chain Correlation

After all Step 2 skills complete, the iac-attack-chain skill reads all Step 2 results and constructs composite, cross-domain attack paths that no individual skill can see. It identifies internet-to-admin compromise paths, ransomware propagation chains, data exfiltration routes, and performs minimum-cut analysis to find the smallest set of fixes that breaks the most attack paths. Output: iac-scan/attack-chain-results.md.

Step 3 — Report Generation

The iac-report skill reads all results from Step 1, Step 2, and Step 2.5, then deduplicates, prioritizes, and outputs findings in three formats: terminal table (printed to stdout), CSV (iac-scan/findings.csv), and HTML (iac-scan/report.html).

Running the Assessment

Tell the agent:

Run IaC security scan

The agent will:

  1. Read this file to understand the workflow
  2. Create the iac-scan/ output directory
  3. Execute Step 1, then Step 2 (parallel), then Step 3
  4. Print findings table to terminal and produce iac-scan/report.html + iac-scan/findings.csv

Scanning a specific directory

Run IaC security scan on the terraform/ directory

Running a single skill

Run the iac-iam skill on this repo

Re-generating the report from existing results

If iac-scan/ already has results from a previous scan, skip Steps 1 and 2:

Generate security report from existing scan results

Fast scan (lite mode)

Run fast IaC scan

Fast mode uses a single combined skill definition (.agents/skills/iac-fast-scan/SKILL.md) instead of 9 separate skills. Read ONLY that one file and follow its instructions. Key differences:

  • Single skill file (~200 lines vs ~7000 lines across 9 skills)
  • Single pass — all domains analyzed together, no separate steps
  • High and Critical only — skip Medium/Low/Info
  • No attack chain correlation — report obvious compound risks inline
  • No architecture diagram — architecture described in prose
  • Output: iac-scan/fast-results.md + iac-scan/fast-report.html
  • ~80-100K tokens vs ~250K+ for full scan

The fast scan is ideal for quick checks, PR reviews, or when token budget is limited. Run a full scan later for complete coverage.

Output Structure

iac-scan/
├── analysis.md                   # Step 1: repository intelligence
├── iam-results.md                # Step 2: IAM findings
├── network-results.md            # Step 2: network findings
├── storage-results.md            # Step 2: storage findings
├── secrets-results.md            # Step 2: secrets findings
├── logging-monitoring-results.md # Step 2: logging findings
├── serverless-results.md         # Step 2: serverless findings
├── attack-chain-results.md       # Step 2.5: cross-domain attack chains
├── findings.csv                  # Step 3: CSV export
├── report.html                   # Step 3: HTML report
└── architecture-diagram.html     # Step 3: architecture visualization (if enough data)

Skill Definitions

Each skill's full instructions live in .agents/skills/:

.agents/skills/
├── iac-analysis/SKILL.md
├── iac-iam/SKILL.md
├── iac-network/SKILL.md
├── iac-storage/SKILL.md
├── iac-secrets/SKILL.md
├── iac-logging-monitoring/SKILL.md
├── iac-serverless/SKILL.md
├── iac-attack-chain/SKILL.md
├── iac-report/SKILL.md
└── iac-fast-scan/SKILL.md    # fast mode only

Individual Skill Commands

You can run individual skills instead of the full pipeline. Each command runs Step 1 (analysis) first if iac-scan/analysis.md does not exist, then runs only the specified skill.

CommandWhat it runs
Run IAM analyzeriac-analysis → iac-iam → writes iac-scan/iam-results.md
Run network analyzeriac-analysis → iac-network → writes iac-scan/network-results.md
Run storage analyzeriac-analysis → iac-storage → writes iac-scan/storage-results.md
Run secrets analyzeriac-analysis → iac-secrets → writes iac-scan/secrets-results.md
Run logging analyzeriac-analysis → iac-logging-monitoring → writes iac-scan/logging-monitoring-results.md
Run serverless analyzeriac-analysis → iac-serverless → writes iac-scan/serverless-results.md
Run attack chain analysisRequires existing Step 2 results → iac-attack-chain → writes iac-scan/attack-chain-results.md
Generate security reportRequires existing Step 2/2.5 results → iac-report → terminal table + iac-scan/report.html + iac-scan/findings.csv

When running an individual skill:

  • If iac-scan/analysis.md already exists, reuse it (skip Step 1).
  • Apply file routing from iac-scan/analysis.md — send only the relevant files to the skill.
  • The skill writes its results to iac-scan/ as usual.
  • No report is generated unless explicitly requested.

Orchestration Rules

  1. Step 1 must complete before Step 2. Domain skills depend on the analysis output.
  2. Skill relevance. After Step 1 completes, read the Recommended Skills table in iac-scan/analysis.md. Skip any Step 2 skill marked as no — do NOT run skills that have no relevant resources in the repository.
  3. File routing. For each relevant Step 2 skill, read the File Routing table in iac-scan/analysis.md. Send each skill only the IaC files listed for it — do NOT send every file to every skill.
    • iac-secrets file scope: Full scan → all repo files (except binaries/vendor). Fast scan or scoped scan → only Secrets File List from analysis.md (IaC, CI/CD, .env*, *.tfstate flags — no .md, docs/, node_modules/).
  4. Compact analysis. Step 2 skills read iac-scan/analysis.md for context (≤ 120 lines). Do not re-read full architecture JSON unless running attack-chain correlation.
  5. Step 2 skills are independent. Try running them in parallel as subagents for speed. Fallback: if subagents fail (e.g., directory is not a git repository), run all Step 2 skills sequentially in the main process instead. The results are identical — only execution speed differs.
  6. Step 2.5 must wait for all Step 2 skills. iac-attack-chain reads all Step 2 results to correlate cross-domain attack paths.
  7. Step 3 must wait for Step 2.5. The report reads every *-results.md file including attack chain results.
  8. If a Step 2 skill fails, continue with the others. The report will note missing inputs.
  9. Each skill writes markdown, not raw JSON. Findings should be human-readable with structured sections for severity, confidence (0.0–1.0), evidence, and attack paths.
  10. Confidence scoring: Every finding includes a confidence score (0.0–1.0). Confirmed findings (direct IaC evidence) score ≥ 0.9. Inferred findings (heuristic, cross-module, unresolved references) score lower. The report uses confidence as a priority modifier — low-confidence speculative findings don't dominate the report.
  11. Output compression: Skill outputs are consumed by downstream skills (attack-chain, report), so keep them compact. Rules:
    • Each finding: max 8 lines (title, severity, confidence, evidence file:line, risk summary, related IDs). No verbose prose.
    • Evidence: cite file:line + one-line snippet. Do not paste full resource blocks.
    • Attack paths: max 5 lines per path (narrative, steps as A → B → C, break points).
    • Positive controls: bullet list, one line each.
    • Target: each *-results.md should be ≤ 150 lines. If a skill produces 20+ findings, group minor ones into a summary table instead of individual sections.

Scoped scan

Scan only IAM and network

Run only the specified domain skills (plus Step 1 analysis). Syntax: Scan only {skill1} and {skill2} or Scan only {skill1}, {skill2}, {skill3}.

Valid domain names: IAM, network, storage, secrets, logging, serverless.

When running a scoped scan:

  • Step 1 runs as usual (analysis is always needed for file routing).
  • Only the listed domain skills run in Step 2. All others are skipped regardless of the Recommended Skills table.
  • Step 2.5 (attack chain) runs only if 2+ domain skills were selected — single-domain scans skip it.
  • Step 3 (report) runs as usual, but only covers the domains that were scanned. The report notes which domains were excluded.
  • File routing still applies — each selected skill receives only its relevant files.
  • iac-secrets uses Secrets File List from analysis.md (not all files).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.