Agents build what you ask for, and nobody asks for security. Here’s the list I run on every app, and how most of it moved out of the prompt into defaults and gates that fail the build.
Ask a coding agent for a notes app with login and you get a notes app with login. It runs, the happy-path test is green, and the Dockerfile probably runs your server as root, because nobody told it otherwise.
The agent didn’t screw up. The prompt never mentioned a content security policy or a test proving Bob can’t read Alice’s notes. It said nothing about six months from now, when one of the hundreds of packages in your lockfile picks up a CVE.
Developers skipped this stuff long before agents existed. What changed is volume. One person with an agent now ships several apps in the time one used to take, and every one inherits the same gaps. A senior engineer reviewing your PR might ask why the container runs as root. The agent will cheerfully write you a root container, a second root container, and a Helm chart for both.
A better security prompt won’t fix that. A prompt is a request, and the agent can drop it. What works is moving each item up a ladder, from something someone has to ask for, to a default the agent inherits, to a gate that fails the build. I build a lot of apps, and most of this list now lives in an open-source template I maintain. Here’s the list, climbing from the bottom rung to the top.
the auth test that matters is the one that says no
The bottom rung holds the things no tool can check for you, and the most important one is a test.
Agents are great at the happy-path test. Log in, get a token, fetch your notes, assert 200. Green. Ship it.
That test proves almost nothing about security. Authentication bugs live on the rejection path. So for every protected route, I want both halves:
- the right user with a valid token gets in
- no token, an expired token, a token from the wrong issuer, and a valid token for a different user all get rejected
That last one is the one that bites. Your auth can be perfect and your authorization can still hand Alice’s data to Bob because a handler looked up the note by ID and forgot to check the owner. Here’s roughly the shape of the test I want for every resource:
#[tokio::test]
async fn bob_cannot_read_alices_note() {
let app = test_app().await;
let alice = app.login("alice").await;
let bob = app.login("bob").await;
let note = app.create_note(&alice, "my diary").await;
let res = app.get(&format!("/notes/{}", note.id), &bob).await;
assert_eq!(res.status(), 404);
assert_eq!(res.error_code(), "not_found");
assert!(!res.text().contains("my diary"));
}
Notice it doesn’t stop at the status code. A 404 that still leaks the note body in an error message is a 404 that failed. Assert the body, and where it matters, assert that no side effect happened.
This can’t be a gate. A scanner has no idea Bob shouldn’t see Alice’s note. So the real question is how you know which Bob tests to ask for.
nobody asks how they’d break in
That question has a name, threat modeling, and it sounds like enterprise paperwork. It’s really one question asked honestly: how would someone break into my app?
Start with the trust boundaries. Browser to API. Mobile app to API. API to background worker. Incoming webhooks. Your app calling out to third-party URLs. For each boundary, ask what the untrusted side controls and what it could do with it. Can it forge a token? Replay a webhook? Upload a 2 GB file? Make your server fetch http://169.254.169.254 and read your cloud credentials?
Then the rule that turns this from a document into something useful. Every threat gets a control, and every control gets a test. The Alice and Bob test above is one row of that table. A row without a test is a gap you can see. A threat you never wrote down is a gap you can’t.
It’s still an ask. But it’s the ask that tells you which other asks to make. And it only covers the attacks you thought of.
attack it before someone else does
For the ones you didn’t think of, you attack yourself.
Pen testing used to mean hiring someone once a year and getting a PDF. Now an LLM can probe your staging environment on every release. In my experience the frontier models get nervous fast. Ask one to attack a login endpoint and you often get a lecture instead of a payload. The open-weight models are far more willing. DeepSeek, GLM and Qwen will happily help you attack your own application and then help you patch what they found. Running them on your own hardware also keeps your app’s internals on your machine.
Two rules. Only point them at systems you own. And treat their findings like a junior’s bug report, a lead worth checking rather than a verdict. Every confirmed finding becomes a regression test and a new row in the threat model.
You can schedule this for every release, but somebody still has to read what comes back and decide what’s real. Everything so far depends on someone asking. The next layer doesn’t have to.
every layer has more rights than it needs
Least privilege is one question asked at every layer. How many rights does my app need? How many does the runtime need? The honest answer is almost always „far fewer than it has.“ And unlike the tests above, the answer can ship as a default.
The container is where it hurts most. If your image runs as root and an attacker gets code execution, they’re root inside the container, and they have whatever tools the base image shipped with. A shell, a package manager, curl. Everything they need to download the next stage of the attack.
Now compare that to this:
FROM rust:1 AS build
WORKDIR /src
COPY . .
RUN cargo build --release
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=build /src/target/release/api /api
USER 65532:65532
ENTRYPOINT ["/api"]
A distroless image has your binary and the libraries it links against. No shell, no package manager, no curl. It runs as an unprivileged user that isn’t in the root group. The same attacker with the same bug now lands in a box with nothing to work with. Assume someone will get in eventually, and make sure they find an empty room when they do.
Then put an alarm in the empty room. Runtime detection tools like Falco watch syscalls and flag the weird stuff, like a shell spawning inside a container that was never supposed to have one. If nobody gets paged when something anomalous happens, you don’t have runtime security. You have runtime hope.
The browser gets the same treatment. A Content Security Policy tells it which scripts, styles and frames it may load, so a single XSS bug no longer means an attacker’s script runs with your user’s session:
Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'self'
Name your real origins in CORS instead of *, and keep tokens out of localStorage. On the network, start from default-deny, allow only the connections each service actually makes, and scope IAM roles to exact calls instead of handing out a shared admin key.
Bake all of that into the base image, the web build and the cluster config, and the agent inherits it on day one without anyone asking.
your app gets less secure while your code stays the same
Defaults cover day one. The part vibe-coded apps fail worst at is day 180.
Your lockfile is a list of strangers. Every dependency is code written by someone you’ve never met, running with your app’s permissions. Some will have a published vulnerability next month, and your app will be exactly as vulnerable as it is today without a single line of your code changing.
Snyk handles this if you have budget. If you don’t, Google’s OSV-Scanner reads your lockfiles, checks them against the OSV database, and runs as a single CI step. Rust has cargo-audit and cargo-deny against the RustSec advisory database. Go has govulncheck, which only flags a vulnerability if your code actually calls the affected function. The same CI step is a good home for gitleaks, which catches the API key that slipped into a commit, and gosec, which lints your own Go code. And rescan the images you already deployed, because the CVE that didn’t exist when you built them exists now.
Pin images by digest so the image you tested is the image you run, and let an admission controller like Kyverno reject anything unpinned, along with pods that mount service account tokens they never use.
Then you need a way to act on what the scanners find. An app is closer to a car than a painting. You don’t finish it and hang it on a wall. You service it, or it leaves you on the side of the road. Dependabot or Renovate open dependency PRs on a schedule you choose. Group the minor bumps so you don’t drown, and let CI tell you whether an update broke anything.
None of these need a security team. They need a CI step that fails the build. An agent can’t argue with a red build. It can, however, edit the file that turns the build red. More on that in a second.
i stopped prompting for security
Nobody remembers all of that on every new app. I certainly don’t, and the agent will never bring it up on its own.
So I stopped trying to remember. I’ve been building Baukit, a kit of shared Rust crates, TypeScript packages, templates and agent skills that every app I build starts from. It’s open source on GitHub. It’s early, it still breaks APIs between minor versions, and it doesn’t cover everything.
In Baukit terms, the gates are OSV-Scanner, cargo-deny and gitleaks in CI, plus Kyverno admission policies on the cluster. The defaults are the distroless non-root image pinned by digest, a CSP baked into the web build, a Renovate preset and Falco. The asks live in two agent skills. One builds the threat model boundary by boundary, where every row names a control and a test. The other writes the security tests: auth negative tests, cross-tenant tests, fuzz targets for parsers of untrusted input, SSRF tests and upload limits. It even tells the agent not to assert only the status code. The LLM pen test is still manual.
The obvious objection is that a skill is just a prompt I wrote once. It is. It’s the bottom rung written down so I don’t have to remember it, and an agent can still skim it, skip it, or lose it when the context fills up. That’s why I rely on the gates, not the skills.
Gates have their own weak spot, though. The CI workflow and deny.toml are files in the repo, and the agent edits files in the repo. One „temporary“ ignore entry and your scanner is decoration. So the gates need guarding too. Branch protection makes the checks required. CODEOWNERS puts the workflow files and scanner config behind a human review. Cluster policies like Kyverno live outside the app repo entirely, which makes them the sturdiest gate of all. The skills get the threat model and negative tests written so the gates have less to catch.
None of this is free. Opinionated defaults go stale, scanners cry wolf, and every breaking Baukit release is work for every app built on it. The template becomes the most important dependency I own, and it needs exactly the servicing I just accused vibe-coded apps of skipping. People have started calling this setup a software factory. If vibe coding mass-produces the gaps, a factory is how you mass-produce the fixes. I maintain one thing carefully so that every app built on it doesn’t depend on me remembering.
the title i almost used
I almost called this post „vibe coders don’t understand anything about security.“ It’s true often enough. It’s also useless, because you can’t lecture your way out of a volume problem. Nobody prompts for security. Not the vibe coder, not the senior engineer at 6pm on a Friday, and definitely not the agent.
So for every item on your own list, ask one question. Can this be a gate? If not, can it be a default? Only what’s left should depend on someone asking.
The prompt will never contain your threat model. Your template can.
Peace, nerds.