LLMs and SLMs Fail Security Compliance in Terraform Generation
A recent arXiv study (2608.02672) assesses the performance of seven AI models in generating secure Infrastructure-as-Code (IaC) for AWS Terraform. This research incorporates Checkov and Trivy security scanners within a GitLab CI/CD pipeline, analyzing three closed LLMs—Claude Opus 4, GPT-5.4, and Gemini 2.5 Pro—and four open SLMs—Qwen2.5-Coder-14B, WizardCoder-33B, CodeLlama-13B, and Magicoder-S-CL-7B—across 17 scenarios. Utilizing two prompting strategies, the study evaluates performance at three security levels using pass@5. Notably, it finds that syntactic validity and security compliance are largely independent; for example, WizardCoder-33B has a 77.8% validation rate but no Checkov compliance, while Claude Opus 4 achieves 23.1% Checkov and 92.5% Trivy pass rates with detailed prompts. The findings emphasize that prompt engineering alone cannot guarantee security, necessitating a focus on security evaluation and innovative IaC generation methods.
Key facts
- Study benchmarks seven models on secure AWS Terraform generation.
- Models include Claude Opus 4, GPT-5.4, Gemini 2.5 Pro, Qwen2.5-Coder-14B, WizardCoder-33B, CodeLlama-13B, Magicoder-S-CL-7B.
- Checkov and Trivy scanners integrated into GitLab CI/CD pipeline.
- 17 scenarios and two prompt strategies evaluated at three security levels.
- Syntactic validity and security compliance are orthogonal.
- WizardCoder-33B: 77.8% validate rate, 0% Checkov compliance.
- Claude Opus 4: 23.1% Checkov, 92.5% Trivy pass rates with detailed security prompting.
- Prompt engineering alone insufficient for security.
Entities
Institutions
- arXiv
- GitLab