<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Taufiqurrohman</title>
    <description>The latest articles on DEV Community by Taufiqurrohman (@afiqxeon).</description>
    <link>https://dev.to/afiqxeon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4254206%2F10118f48-265b-4bbd-b02f-a1c96593861f.jpg</url>
      <title>DEV Community: Taufiqurrohman</title>
      <link>https://dev.to/afiqxeon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/afiqxeon"/>
    <language>en</language>
    <item>
      <title>Your Terraform IAM Policies Are Haunted (Here's How I Exorcised Them with Kiro)</title>
      <dc:creator>Taufiqurrohman</dc:creator>
      <pubDate>Thu, 19 Nov 2026 16:44:13 +0000</pubDate>
      <link>https://dev.to/afiqxeon/your-terraform-iam-policies-are-haunted-heres-how-i-exorcised-them-with-kiro-3g1</link>
      <guid>https://dev.to/afiqxeon/your-terraform-iam-policies-are-haunted-heres-how-i-exorcised-them-with-kiro-3g1</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: This post is written as part of my submission for the **Kiroween 2026&lt;/em&gt;* hackathon.*&lt;/p&gt;

&lt;p&gt;Most AWS accounts have a zombie problem.&lt;/p&gt;

&lt;p&gt;Not the movie kind. The &lt;code&gt;s3:*&lt;/code&gt;, &lt;code&gt;dynamodb:*&lt;/code&gt;, and &lt;code&gt;iam:PassRole&lt;/code&gt; on &lt;code&gt;Resource = "*"&lt;/code&gt; kind.&lt;/p&gt;

&lt;p&gt;Policies written in a rush during a Friday deployment. Never touched again. Silently waiting for one leaked key to turn a minor bug into a full-blown breach.&lt;/p&gt;

&lt;p&gt;Everyone knows you should enforce least-privilege IAM.&lt;/p&gt;

&lt;p&gt;The catch?&lt;/p&gt;

&lt;p&gt;Auditing CloudTrail logs by hand is brutal. Mapping 500+ API calls back to Terraform HCL2 blocks takes hours. &lt;/p&gt;

&lt;p&gt;So naturally, people throw an LLM at the &lt;code&gt;.tf&lt;/code&gt; file and say, &lt;em&gt;"Fix my IAM permissions."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Big mistake.&lt;/p&gt;

&lt;p&gt;Raw LLMs love to improvise. They hallucinate JSON keys. They break HCL2 syntax. Worse, they randomly delete permissions your app actually needs in production.&lt;/p&gt;

&lt;p&gt;One bad string replacement and your deployment pipeline goes down at 2 AM.&lt;/p&gt;

&lt;p&gt;So for &lt;strong&gt;Kiroween 2026&lt;/strong&gt;, I built &lt;strong&gt;FrankenGuard&lt;/strong&gt; using &lt;strong&gt;Kiro&lt;/strong&gt;—an autonomous IAM least-privilege engine that refuses to let an AI blindly edit code.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/9X5fDJgfpM0" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;




&lt;h3&gt;
  
  
  How I Used Kiro to Keep the AI on a Leash
&lt;/h3&gt;

&lt;p&gt;Before Kiro, building an AI DevSecOps agent meant writing a giant prompt and praying the model obeyed.&lt;/p&gt;

&lt;p&gt;With Kiro, I split &lt;strong&gt;reasoning&lt;/strong&gt; from &lt;strong&gt;code mutation&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Kiro Specs (&lt;code&gt;FR-01&lt;/code&gt; to &lt;code&gt;FR-05&lt;/code&gt;):&lt;/strong&gt; Before writing application code, I locked down strict functional requirements—zero wildcards allowed, mandatory &lt;code&gt;aws:SourceArn&lt;/code&gt; condition blocks, and automated post-patch verification.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kiro Steering Rules:&lt;/strong&gt; I added five non-negotiable guardrails into &lt;code&gt;.kiro/steering/&lt;/code&gt;. The agent is strictly forbidden from doing raw text or regex replacements on Terraform files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kiro Crew + Custom MCP Server:&lt;/strong&gt; Instead of one overloaded prompt, Kiro Crew orchestrates specialized roles—a Telemetry Auditor, an IAM Graph Analyst, and an AST Patcher—connected over a custom MCP bridge.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  The Secret Weapon: C++ Tree-sitter AST Surgery
&lt;/h3&gt;

&lt;p&gt;Here is how a remediation actually runs inside FrankenGuard:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — Telemetry Truth:&lt;/strong&gt; The agent cross-checks your declared Terraform IAM policies against real AWS CloudTrail runtime logs. It separates what your workload actually uses from dead wildcards and lateral-movement traps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — Surgical HCL2 Patching:&lt;/strong&gt; Kiro never touches the &lt;code&gt;.tf&lt;/code&gt; text directly. It passes only the verified actions and target ARNs to a native &lt;strong&gt;C++ Tree-sitter HCL2&lt;/strong&gt; engine. Tree-sitter locates the exact &lt;code&gt;policy = jsonencode(...)&lt;/code&gt; AST node and swaps it in-place with clean, least-privilege HCL2. Comments, formatting, and surrounding resources stay 100% intact.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 — Monster Anatomy View:&lt;/strong&gt; A real-time visual dashboard tracks every severed permission edge and drops blast-radius risk scores by over &lt;strong&gt;90%&lt;/strong&gt; (e.g., from &lt;strong&gt;96/100 Vulnerable&lt;/strong&gt; down to &lt;strong&gt;8/100 Least-Privilege Enforced&lt;/strong&gt;).&lt;/p&gt;




&lt;h3&gt;
  
  
  Building Secure AI Tools Is Fun
&lt;/h3&gt;

&lt;p&gt;The biggest lesson from building &lt;strong&gt;FrankenGuard&lt;/strong&gt; during &lt;strong&gt;Kiroween 2026&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Don't ask an LLM to be a compiler.&lt;/p&gt;

&lt;p&gt;Let Kiro's specs, steering guardrails, and MCP orchestration handle the security reasoning—and let deterministic AST tools do the surgery.&lt;/p&gt;

&lt;p&gt;Watch the full 3-minute live demo here: &lt;a href="https://youtu.be/9X5fDJgfpM0" rel="noopener noreferrer"&gt;https://youtu.be/9X5fDJgfpM0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy hacking,&lt;/p&gt;

&lt;p&gt;Taufiqurrohman&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P.S. If you're entering Kiroween 2026 too, seriously—put your agent rules inside &lt;code&gt;.kiro/steering/&lt;/code&gt;. It saves hours of debugging hallucinated file edits.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>kiroween</category>
      <category>aws</category>
      <category>ai</category>
      <category>terraform</category>
    </item>
  </channel>
</rss>
