All skills
hardw00t avatar

/iac-security

@f9bb3b2

Infrastructure-as-Code security scanning router for Terraform, CloudFormation, Kubernetes manifests, Helm, ARM/Bicep. Orchestrates Checkov, tfsec, Terrascan, KICS, kubesec, kube-linter, Polaris, cfn-lint/cfn-nag, and OPA/Conftest. Use when auditing IaC for misconfigurations, scanning Terraform plans, validating K8s security policies, checking cloud infrastructure compliance, or authoring custom policy-as-code (Rego).

Use this Skill: https://skilld.dev/gh/hardw00t/ai-security-arsenal/iac-security

This session only. Nothing lands on disk.

referencesci_cd_integration.md

≈781 tokens on demand. Your agent reads this file only when SKILL.md points to it.

CI/CD Integration Reference

Wire IaC scanners into PR gates and pre-commit hooks.

GitHub Actions

name: IaC Security Scan

on:
  pull_request:
    paths:
      - 'terraform/**'
      - 'k8s/**'
      - 'cloudformation/**'

jobs:
  checkov:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Checkov
        uses: bridgecrewio/checkov-action@v12
        with:
          directory: .
          framework: terraform,kubernetes,cloudformation
          output_format: sarif
          output_file_path: checkov.sarif
          soft_fail: false
      - name: Upload SARIF
        uses: github/codeql-action/upload-sarif@v2
        with:
          sarif_file: checkov.sarif

  tfsec:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run tfsec
        uses: aquasecurity/tfsec-action@v1.0.0
        with:
          working_directory: terraform/
          soft_fail: false

  trivy-config:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Trivy config scan
        uses: aquasecurity/trivy-action@master
        with:
          scan-type: 'config'
          scan-ref: '.'
          severity: 'HIGH,CRITICAL'
          exit-code: '1'

Put each scanner in its own job so they run concurrently.

GitLab CI

stages:
  - security

checkov:
  stage: security
  image: bridgecrew/checkov:latest
  script:
    - checkov -d . --framework terraform,kubernetes -o junitxml > checkov.xml
  artifacts:
    reports:
      junit: checkov.xml
  only:
    changes:
      - "**/*.tf"
      - "**/*.yaml"
      - "**/*.yml"

tfsec:
  stage: security
  image: aquasec/tfsec:latest
  script:
    - tfsec . --format junit > tfsec.xml
  artifacts:
    reports:
      junit: tfsec.xml
  only:
    changes:
      - "**/*.tf"

Pre-commit Hooks

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.83.0
    hooks:
      - id: terraform_fmt
      - id: terraform_validate
      - id: terraform_tfsec
      - id: checkov
        args: ['--framework', 'terraform']

  - repo: https://github.com/zricethezav/gitleaks
    rev: v8.18.0
    hooks:
      - id: gitleaks

Gate policy recommendation

  • pre-commit: fast scanners only (tfsec, cfn-lint). Hard fail only on CRITICAL.
  • PR check: full scanner fleet in parallel. Hard fail on HIGH+, warning on MEDIUM.
  • main branch / nightly: add KICS + Conftest/OPA policy suite. Emit SARIF to centralized dashboard.

Compliance framework filters

Framework Checkov flag tfsec flag
CIS AWS --check CKV_AWS_* Built-in
CIS Azure --check CKV_AZURE_* Built-in
CIS GCP --check CKV_GCP_* Built-in
CIS Kubernetes --check CKV_K8S_* N/A
# Map Checkov findings to BC/compliance IDs
checkov -d . --framework terraform --check CKV_AWS_* --output-bc-ids
checkov -d . --list | grep -i encryption

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides a robust and well-structured routing mechanism for Infrastructure-as-Code (IaC) security tools. It includes low-severity findings related to a demonstration credential inside an intentional test fixture file, the usage of a remote external Kubernetes testing API, and potential indirect prompt injection vectors from unvalidated repository configuration files.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    1/1 file flagged

Signed by skilld at f9bb3b2. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 6 months ago

README badge

README badge for hardw00t/ai-security-arsenal/iac-security