AWS Builder Center
How I Built a Browser-Only Cloud Security Scanner With Kiro

How I Built a Browser-Only Cloud Security Scanner With Kiro

PhantomGuard scans Terraform, Dockerfiles and AWS IAM policies in your browser and proposes least-privilege fixes. Built with Kiro for Kiroween 2026.

#KiroweenHackathon26
What building a haunted-house security scanner taught me about findings people actually read, and about trusting AI-written code.
You know the report. Four hundred findings, sorted by nothing in particular. Some describe settings that stopped mattering years ago. None explain why you should care. So you fix the two that look scary and close the tab.
A finding nobody reads protects nobody.
For the Kiroween 2026 Costume Contest, I built the opposite: a cloud security scanner you want to explore, and one that refuses to say anything it can't back up. It's called PhantomGuard, and it's dressed as a haunted house. Vulnerabilities are poltergeists. Resources with problems are zombie resources. Fixes are exorcisms.
Below: what it does, the five design rules behind it, and what building it with Kiro taught me.

The one rule above the costume

One line in my Kiro steering file shaped more decisions than any other:
The costume is a haunted house. The wearer is a serious, deterministic security tool. When the two conflict, the tool wins.
That line answered most design questions before they came up. Spooky words are welcome in the interface, but they may never hide a fact. Every poltergeist card still states the rule ID, the severity and the problem in plain words. The command-line tool, the JSON output and the SARIF report use only technical terms. The costume stays in the browser.

What PhantomGuard does

PhantomGuard reads three kinds of infrastructure code: Terraform, Dockerfiles and AWS IAM policies. It checks them against six rules, each mapped to a published benchmark or to AWS guidance:
Rule
What it finds
Mapped to
 PG-IAM-001 
Wildcard permissions:  * ,  s3:* ,  s3:Get* ,  NotAction 
CIS AWS Foundations v3.0.0, 1.16 (full  *:*  admin); AWS IAM least privilege
 PG-IAM-002 
Allow statements open to any principal
AWS IAM least privilege
 PG-NET-001 
Security group ingress from  0.0.0.0/0  or  ::/0 
CIS AWS Foundations v3.0.0, 5.2 (admin ports); AWS FSBP EC2.18
 PG-STO-001 
EBS and RDS without encryption at rest; S3 without a declared encryption setting
CIS AWS Foundations v3.0.0, 2.2.1 and 2.3.1
 PG-STO-002 
S3 buckets with a public ACL or policy, or without all four Block Public Access settings
CIS AWS Foundations v3.0.0, 2.1.4
 PG-CTR-001 
Containers that run as root, or privileged
CIS Docker Benchmark v1.7.0, 4.1
It has two modes.
Mode 1, Inspect Haunted Cloud. A pre-loaded, fictional AWS account. A dashboard counts the zombie resources, the poltergeists haunting them, the worst estimated CVSS score and the exorcisms you've performed. Zombie resources glow red and clean ones glow green. Click any resource and a drawer opens with an estimated CVSS score, a plain-language explanation of the risk, and the fix shown side by side: vulnerable on the left, hardened on the right. Exorcise the over-privileged admin role and its card turns from red to green.
Mode 2, Scan Custom Config. Paste or drop your own Terraform, Dockerfile or IAM policy. Each finding shows the offending source lines, its compliance references and the same side-by-side fix, with buttons to copy the hardened version or the unified diff. The page shows how long each scan took. In Node, the engine scans the sample files in about a millisecond and a 51 KiB Terraform file in about three.
The same engine powers a command-line tool with  pretty ,  json  and SARIF output, so a CI pipeline can fail the build when a finding crosses a severity threshold.

Five design rules

1. Nothing leaves your browser

People won't scan real infrastructure code if they have to upload it. So PhantomGuard has no backend, no login and no upload. The engine is a TypeScript library with zero runtime dependencies and no browser or Node APIs. In the web app it runs in a Web Worker bundled into the page, so a scan makes no network request. The Netlify configuration ships a Content-Security-Policy that blocks connections to any other origin.
The safest data is the data you never collect.

2. Accuracy beats alarm

The easy rule is to flag every S3 bucket without an encryption block as "unencrypted." That has been wrong since January 2023, when Amazon S3 began encrypting every new object by default. Public access changed the same way: since April 2023, new buckets get Block Public Access turned on by default.
So PhantomGuard words those findings carefully. A bucket with no encryption declaration gets a MEDIUM finding that says S3 already encrypts new objects, and that the gap is a missing explicit declaration. Declaring the setting makes the intent auditable and keeps it true if defaults change.
Edge cases get the same care. A bucket policy statement that denies everyone (the standard "require TLS" pattern) is a safeguard, so PhantomGuard never reports a Deny statement as public.
A scanner that cries wolf trains people to ignore the real wolf.

3. Least privilege comes from evidence

This is the fix I'm proudest of. The demo account has an IAM role that allows everything:
{
"Sid": "EverythingForEveryone",
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
The demo also carries usage evidence, the kind access analysis produces: the role called six actions on four resources. So the exorcism grants exactly those:
{
"Sid": "EverythingForEveryone",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"s3:GetObject",
"s3:ListBucket",
"sqs:DeleteMessage",
"sqs:ReceiveMessage"
],
"Resource": [
"arn:aws:logs:us-east-1:123456789012:log-group:/mansion/*",
"arn:aws:s3:::crypt-backups",
"arn:aws:s3:::crypt-backups/*",
"arn:aws:sqs:us-east-1:123456789012:seance-queue"
]
}
Without usage evidence, PhantomGuard falls back to a short read-only list for the service and says so. For a bare  *  with no evidence, it gives guidance instead of a patch. It never invents a permission. Every IAM fix is marked Review required, because a policy that grants only what's listed will deny whatever the list missed.
Least privilege you guess at is just an outage you haven't met yet.

4. A fix must never make things worse

Every exorcism follows three rules:
  1. It only narrows. A fix never adds an action, a wildcard, a port or a network source.
  1. It asks before changing behavior. Removing an ingress rule, replacing an unencrypted volume or changing a container's user is marked Review required, and Mode 1 asks you to confirm.
  1. Twice equals once. Applying the same fix again changes nothing, and a fix computed for an older version of a resource is rejected instead of applied to the wrong thing.
Fixes are previews. Nothing in PhantomGuard writes to a cloud account: Mode 1 applies fixes to the fictional account in memory, and Mode 2 lets you copy them.

5. The costume has to be readable

A neon haunted house is easy to make unreadable, so the color rules are strict. Neon red means "this is a problem." Neon green means "this is safe now." Nothing else uses either color. Severity is never color alone: every badge pairs a color with an icon and a text label.
The glass panels were measured, not eyeballed. On the brightest background a panel can sit on, the dimmest text color (neon red) measures 4.64:1, above the 4.5:1 that WCAG AA requires for normal text. Animations stop when your system asks for reduced motion. The resource drawer uses the browser's native modal dialog, which provides a focus trap, the Escape key and focus return.

How Kiro shaped the build

I built PhantomGuard with Kiro, an agentic development environment, using a spec-driven workflow. Four features did most of the work.
A spec written as testable sentences. The requirements use EARS syntax, which turns vague wishes into statements you can check. There are 23 requirements with 151 acceptance criteria, like this one:
WHEN an IAM policy statement has Effect  Allow  and an Action of  *  or  *:* , THE Core_Engine SHALL report a CRITICAL Finding with rule id  PG-IAM-001 .
The design document turns those criteria into 19 correctness properties, and the task plan cites the criteria each task satisfies. A small governance script fails if a criterion has no task or a task cites a criterion that doesn't exist.
Steering files. Three Markdown files hold the rules Kiro applies to every change: the costume, color and contrast rules ( product.md ); the engineering standards, including strict TypeScript and a dependency-free engine ( tech.md ); and the security guardrails, CIS mappings and least-privilege patch format ( secops-guardrails.md ).
A hook that keeps tests in step. When a detection rule file is saved, a Kiro hook tells the agent to create or update that rule's property-based test. It fired every time a rule changed.
Property-based tests. Instead of a few hand-picked examples, 56 of the 57 tests are fast-check properties that generate at least 200 inputs each and check a universal statement, such as:
For any IAM patch, the set of actions after the patch is a subset of the actions the original statement already granted or of the evidence list, contains no  * , and the Resource set is not larger than before.
The expected answers come from the requirements, not from the rule's own code. A test that copies the implementation can only agree with it.

The moment the AI was wrong

Midway through the build, Kiro reported that the core engine was complete. It wasn't.
On the next prompt, before building anything on top, Kiro ran a strict build and reported its own mistake: 17 type errors, a Terraform parser that misread strings and never translated Terraform names into the shape the rules read, and an S3 rule that would have flagged a harmless Deny statement as CRITICAL. It said so in plain words, "My last report was wrong," and rewrote the broken parts.
My takeaway: don't ask an AI whether it's done. Ask it to prove it. So we added checks that don't care how confident anyone sounds:
  • Strict TypeScript, with every extra safety flag on.
  • Property tests whose expected answers come from the spec.
  • Mutation checks. Kiro broke the new S3 rule on purpose, three ways: flagging Deny statements, over-rating a missing setting, and a fix that set only one of four settings. Each broken version failed the right tests. A test that can't fail proves nothing.
  • Fuzzing. The Terraform parser took 30,000 random inputs without throwing, gave identical results on repeat, and parsed about 1 MiB of hostile input in at most 235 ms.
Confidence is a claim. A passing check is evidence.

What PhantomGuard doesn't do yet

Good tools are honest about their edges. Here are mine:
  • Terraform support is a subset. It reads ten resource types, plus four S3 companion resources that it merges into their bucket. Values that depend on variables or references are reported as unresolved, never guessed. Modules and  dynamic  blocks aren't analyzed yet, and  data "aws_iam_policy_document"  blocks are skipped with a message saying so.
  • CVSS scores are estimates. CVSS was designed for software vulnerabilities, not misconfigurations. PhantomGuard assigns a CVSS v3.1 vector to each rule and severity and computes the score with the official equations, which reproduce 18 published scores. The app labels every score as an estimate.
  • The haunted account is fictional. It uses AWS's documentation example account ID, 123456789012.
  • Fixes are previews. The CLI prints diffs and never edits files. Writing fixes back into source files is on the roadmap.

Lessons I'm keeping

  • Attention is borrowed. Trust is earned. The costume gets the first look. Accuracy gets the second.
  • Say less and mean it. One correct MEDIUM beats ten dramatic CRITICALs.
  • Fix from evidence. If you can't see what a role uses, don't pretend you can.
  • Ask before you break things. A fix that can change production behavior should say so and wait.
  • "Done" is a test result, not a status message.
  • Write the spec first. It's the cheapest way to make an AI's work checkable.

Try it

Open the live app, find the red admin role in Mode 1, and perform your first exorcism. Then paste a Terraform file you know well into Mode 2 and see what haunts it.
If you find a false alarm, open an issue. A scanner gets better one wrong answer at a time.
Open to Cloud Ops Remote and technical writing projects.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article