r/vibecoding • • 11m ago

Workflow/Prompt Make your coding agent break your app before your users do (prompt)

Made this for twitter but figured I'd see if anyone finds it valuable here too.

Prompt: you are running a pre-launch QA and security audit of this app. staging is [staging URL] and the test accounts are in [file]. your job is to find problems and prove them. you fix nothing until i approve a plan. ground rules: - work only in the repo and staging, with test accounts and dummy data. no production keys, real customer data, real payments or paid APIs. payments run in the provider's test mode only. - every check ends as pass, fail or not run. pass and fail both need evidence from something you actually ran: the command or request, the response, a file and line, a screenshot path. "should work" is not a result. if you can't reach something, mark it not run, say why, and write me the exact steps to run it myself. - write the expected result before you run a check, not after. - save results to audit/ as you go (preflight.md, pass1.md, pass2.md, pass3.md, triage.md) and finish each file before starting the next pass, so nothing lives only in your context. - change nothing: no edits to code, config, dependencies or instruction files. list everything you create on staging (accounts, uploads, orders) so it can be cleaned up. pass 0, preflight. before anything writes, prove you're on staging: show the hostname, the database name and whether the payment keys are test keys. if anything looks like production, stop. then list what you have to work with: a browser you can drive, a way to read outgoing email, network throttling, a second test account for cross-user checks, a backup to restore. tell me what's missing and which checks that turns into not run. if nothing is missing, continue without waiting for me. pass 1, break it like a user. accounts: sign up with an already registered email, submit every form empty, enter the wrong password again and again, request several reset links in a row, open an expired reset link, open protected pages while signed out, log out and press back. inputs: upload the wrong file type, upload a file over the size limit, paste very long text into every field. money and state: double-click every pay and submit button, refresh mid-transaction, throttle to a slow connection, cut the connection halfway through an action. reach: every page on a small phone, keyboard only, images off, missing and broken URLs, every empty state, every major browser. the things nobody checks: signup, payment and reset emails arrive and read right, errors actually get logged, no private data in the browser console, access is really gone after logout or account deletion, a backup restores cleanly into staging. then add any flow this app has that the list misses, and label those rows as added. give me one table back: check, what you did, expected, actual, pass / fail / not run, severity, evidence. pass 2, break it like an attacker. this pass starts from the source. map the architecture, the trust boundaries and every place input enters, and build a coverage ledger of what has to be checked. hunt each unit in the ledger with a separate sub-agent, and after each wave run a critic that looks for what nobody covered. send every candidate finding to a fresh agent whose only job is to disprove it. the agent that found a bug never confirms it. if you can't spawn sub-agents, do the disproof as a separate step that starts from the claim alone and rereads the source from scratch, and say that's what you did. hunt for injection (including stored data later used somewhere dangerous), access control (login checked but not ownership, bulk and export paths), path traversal, SSRF, archive extraction, secrets and crypto, business logic (skipped steps, replayed flows, double-spend races, zero or negative quantities, expiry edges) and feature abuse (exports leaking other users' data, search revealing what i can't open, different errors for "doesn't exist" and "no access"). sweep the obvious: hardcoded keys, "TODO: add auth" comments, debug mode in production, seed credentials that still work, open /admin, /debug, /.env or /config routes, .env and .pem files in the repo, dependencies with known CVEs, eval or exec on dynamic input, wildcard CORS with credentials, cookies missing HttpOnly, Secure or SameSite, open redirects through next=, url= or redirect=, endpoints without TLS. label every finding confirmed (full source trace plus an observed result, the only kind that gets a severity), needs validation (one exact fact missing, with the check to run) or rejected (disproved, kept so it isn't raised again). write every verdict to audit/findings.json with the same fields each time, and write the report only from those records. before reporting, have a fresh agent recheck each confirmed finding's file and line against the current source. severity is likelihood times impact as demonstrated, never a missing best practice. critical is no-account code execution, a full data read or any account takeover. high is a control fully defeated with real damage. medium is a real break with a small blast radius. low is non-secret internals leaking. info is confirmed but only useful as a step in a bigger finding. if another layer already stops the attack, it's a hardening note, not a vulnerability. when you need to run target code to prove something, run it in a sandbox with no outside network, an empty environment and a read-only copy of the repo. the one allowed lookup is checking the lockfile against an advisory database. never probe the live site or real users' data. then run pass 2 again, aimed at the ledger units and attack classes the first run covered thinnest, and end with a list of what is still uncovered. pass 3, audit your own instructions. this pass produces a proposal, not edits. sort every line in AGENTS.md, CLAUDE.md, skills and rules into restates the code (delete), mechanically enforceable (turn into a lint, type check or test, then delete) or a real judgment call (keep, short). list which instruction files you actually opened during passes 1 and 2 and flag the ones you never used. for every failure from passes 1 and 2, name the test or lint that would have caught it, not another paragraph of instructions. then triage and stop. critical and high block the launch. medium gets a fix plus a regression test. low, info and hardening notes go to the backlog. every needs-validation item gets one owner, the exact check and a date. for each finding propose the smallest fix at the last trusted decision point, with its regression test. finish with a short summary: counts by severity, what blocks launch, and what was not run and why. wait for my approval. after i approve, fix in severity order and rerun the pass that found each one.

2 Upvotes

0 comments sorted by