Before You Ship: The Checklist
Part of Vibe Coding Securely, a short, hands-on book about shipping the app an AI built without getting owned.
This is the book folded down to one page. It is meant to be walked before every deploy, not read once. Each line is a chapter in miniature, with a quick way to prove it rather than assume it, because a check you can run beats a box you tick. Where a line says to attack or grep your own app, do it; a few minutes here is cheaper than the alternative.
Secrets (chapter 2)
- No API key, token, or password appears in any code that runs in the browser. Prove it: build your app and search the browser files for a known secret. It should not be there.
- No secret is committed to git, now or in your history. The real values live as environment variables on your host, never in the repo.
- Anything that ever leaked, to the browser or to git, has been rotated: a new value generated at the service, the old one disabled. Moving a key stops the next leak; rotating closes the one that already happened.
Identity and permission (chapters 3 and 4)
- Your server decides who a request is from, using something the visitor cannot forge, never a plain id or role the browser sends. Prove it: try calling a protected route with a hand-set cookie and confirm it is refused.
- You did not write your own passwords, resets, and sessions. You leaned on your platform or a trusted auth library. Hand-rolled auth is a lot of ways to be subtly wrong.
- Every query that returns a user’s data is scoped to that user, in the query itself. The request is never “get the note,” it is always “get the note, if it is theirs.” Prove it: log in as one user and try to read another user’s record by its id. You should get nothing.
- If you use a hosted database, row-level security is on, so a forgotten filter cannot leak someone else’s row.
Input (chapter 5)
- Every database query uses bound parameters, the placeholder style, with no user text glued into the SQL string. No exceptions, not even for values you think the user cannot control.
- User text is rendered as text and escaped by your framework. You are not using
dangerouslySetInnerHTMLor any equivalent on anything a user typed. Prove it: save a note whose body is<img src=x onerror="alert(1)">and confirm it shows as characters, not a running tag. - If you genuinely need to allow formatting, you use a maintained sanitizer or render Markdown with a library that escapes HTML, never a hand-written filter.
AI features (chapter 6)
- The model only ever receives the data the asking user is allowed to see. Whatever it can see, assume it can say. Prove it: ask the feature a plain question as one user and confirm another user’s data never appears in the answer or the sources.
- The model has the least power to act that the feature needs. An assistant that only reads and summarizes has no tools. Any tool it does have is scoped, logged, and, for anything irreversible, gated behind a human confirmation.
- You fence user content as data in the prompt, and you do not rely on that fence holding. The safety is the scoping and the lack of tools, so that a successful prompt injection is boring.
Shipping (chapter 7)
- Every debug, test, or seed route is deleted. Prove it: search your project for routes with “debug” or “test” in the name, and open each API route while logged out to see what a stranger gets.
- CORS is closed. You are not reflecting arbitrary origins or allowing credentials for other sites. A same-origin app needs no CORS headers at all.
- Sensitive and paid endpoints have a rate limit, so logins cannot be brute-forced and a paid AI feature cannot run up your bill. This is often a switch on your host rather than code you write.
- Error responses are generic. The stack trace and versions are logged on the server, not sent to the visitor.
- Secrets are set as environment variables on the host, and none of them carry a
NEXT_PUBLIC_name, which would ship them to the browser.
When it goes wrong (chapter 8)
- You can see recent account activity, so an unfamiliar login is something you could notice.
- You can contain a leak fast: sign out everywhere to kill a stolen session, rotate a key to kill a stolen key. Whatever leaked, you have the one action that makes it worthless.
- You know the order before you need it: contain first, then see what happened, then fix the hole, then tell anyone whose data was exposed, plainly and soon.
Using AI to review (chapter 9)
- You ran an AI review as a first pass and treated its output as leads, not verdicts. You reproduced each issue it raised, because some will be real, some confidently wrong, and your worst problems may be the ones it never mentioned because they are things you never built.
- For anything where the stakes are real, you got a careful human to look, precisely at the misdiagnoses and the absences a model talks past.
The habit underneath
If you remember nothing else, remember the shape. You do not bolt security on at the end. You attack your own app as you build it, you fix what breaks, and you prove each fix with a check that could have failed. Everything above is that one habit, applied to the handful of places an AI tool tends to get wrong. Walk the list, run the proofs, and ship.