snyk/studio-recipes/iac-security
Claude Code and agent skill by snyk/studio-recipes
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Infrastructure as Code security scanning for Terraform, Kubernetes, CloudFormation, and Azure ARM. Detects misconfigurations, security risks, and compliance violations before deployment. Use when: - User asks to scan Terraform files or modules - User mentions "infrastructure security" or "IaC scan" - User is working with Kubernetes manifests - User asks about CloudFormation or ARM template security - Agent is generating or modifying infrastructure code
Install
npx vskill@latest install snyk/studio-recipes/iac-securitySemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as snyk/studio-recipes/iac-security.
Infrastructure as Code Security
Comprehensive security scanning for Infrastructure as Code to catch misconfigurations before they become production vulnerabilities.
Core Principle: Security issues are cheaper to fix in code than in production.
Quick Start
Supported IaC Formats
| Platform | File Types | |
|---|---|---|
| Terraform | .tf, .tf.json, .tfvars | |
| Terraform Plan | JSON plan output (terraform show -json) | |
| Kubernetes | .yaml / .yml with apiVersion + kind | |
| Helm | Chart templates (requires Chart.yaml) | |
| AWS CloudFormation | .json / .yaml with AWSTemplateFormatVersion | |
| Azure ARM | .json with $schema ARM URL | |
| Serverless Framework | serverless.yml |
Phase 1: Discovery
Goal: Identify all IaC files that need scanning.
Check for these indicators to confirm IaC type:
- Terraform:
.tffiles,terraform.tfstate,providerblocks - Kubernetes: YAML with
apiVersion/kind, directories namedk8s,manifests - CloudFormation:
AWSTemplateFormatVersionkey,Resourcessection with AWS types - Azure ARM:
$schemacontainingdeploymentTemplate
Then determine scan scope: single file, directory, or recursive.
Phase 2: Execute Scan
Goal: Run appropriate IaC security scan.
Basic Scan
Terraform with Variables
Terraform Plan (more accurate)
Custom Rules
Phase 3: Analyze Results
Goal: Understand and categorize misconfigurations.
Severity Assessment
| Severity | Risk Level | Examples | |
|---|---|---|---|
| Critical | Immediate risk | Public S3, open security groups | |
| High | Significant risk | Missing encryption, excessive perms | |
| Medium | Moderate risk | Missing logging, broad IAM | |
| Low | Best practice | Missing tags, suboptimal config |
Generate Summary
Categorize by Domain
Group issues for easier remediation:
- Network Security: Security groups, Network ACLs, Load balancer config, VPC settings
- Data Protection: Encryption at rest/in transit, Backup configuration, Key management
- Access Control: IAM policies, Service accounts, RBAC settings, API permissions
- Logging & Monitoring: CloudTrail/audit logs, Access logging, Alerting config
Phase 4: Remediation
Goal: Provide secure configuration fixes. Apply the pattern below to each finding; representative examples follow.
Terraform Fixes
S3 Bucket β Block Public Access
Security Group β Restrict Access
RDS β Enable Encryption
Kubernetes Fixes
Pod Security β Non-Root User & Resource Limits
Network Policy β Restrict Traffic
CloudFormation Fixes
S3 Bucket β Encryption & Public Access Block
Phase 5: Verification
Goal: Confirm fixes are effective.
Re-scan After Changes
For Terraform, regenerate and scan the plan:
Report Improvements
Best Practices
Prevention
- Scan in CI/CD: Fail builds with critical issues
- Pre-commit hooks: Catch issues before commit
- Module security: Scan reusable modules
- Policy as code: Define custom rules for org standards
Policy File Usage
Create .snyk to manage exceptions:
Custom Rules
For organization-specific requirements:
- Write rules in Rego (OPA) format
- Bundle as
.tar.gz - Pass to scan with
--rulesoption
Error Handling
| Error | Solutions | |
|---|---|---|
| Could not read Terraform state | Run terraform init; check state backend; scan .tf files directly | |
| Invalid HCL syntax | Run terraform validate; check syntax; ensure all variables are defined | |
| Could not parse plan file | Regenerate with terraform show -json; check Terraform version compatibility; verify JSON validity |
Constraints
- Scan before apply: Never apply unscanned IaC
- Block on critical: Critical issues must be fixed
- Document exceptions: Use
.snykpolicy for accepted risks - Validate plans: Prefer plan scanning over file scanning for Terraform
- Continuous monitoring: Re-scan when dependencies update
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcommand_directives/synchronous_remediation/skills/iac-security/SKILL.md
Popularity
- Repository stars
- 48
- Repository forks
- 30
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/snyk/studio-recipes/iac-security)