Vibe coding security: a checklist before real users sign up
Originally published at pantheontable.com/blog/vibe-coding-security-checklist Deleting a leaked API key from your code does not make it safe. Copies stay in your Git history. If strangers are now typing their details i
Originally published at pantheontable.com/blog/vibe-coding-security-checklist
Deleting a leaked API key from your code does not make it safe. Copies stay in your Git history.
If strangers are now typing their details into an app you built by describing it, this checklist is for you. It takes the risks in the order that hurts users most, with what Andrej Karpathy, Pieter Levels, Patrick McKenzie, Jeff Atwood, Arvid Kahl, Simon Willison and Joel Spolsky said about each one, every record linked to its source.
The short answer
Before you invite more people, close the risks that would hurt them first. Take every API key out of the code and revoke any that leaked, confirm payments on your server and leave card data with the processor, cap what one user can trigger, and prove you can restore a backup. Then have a fresh reviewer audit the whole app, because vibe coding security comes down to the checks the AI did not run for you.
Why code written by AI needs your checks now
You built the app by describing what you wanted, and now strangers are typing their details into it. Being scared of a leak at this point is reasonable, not paranoid. GitHub's own description of vibe coding separates the quick prototype, where little of the result gets read or tested, from the human-led kind, where you review, test and refine. Real users move you into the second kind, whether you planned it or not.
Checked fact: It separates full vibe coding (little reading or testing of the result, suited to quick experiments and prototypes) from human-led vibe coding (you review, test and refine).
GitHub, resources article 'What is vibe coding?', checked 2026-11-18
Checked fact: Risks it names when checks are skipped: hardcoded credentials, insecure endpoints, unvalidated input, messy structure and technical debt.
GitHub, resources article 'What is vibe coding?', checked 2026-11-18
"Ultimately, vibe coding full web apps today is kind of messy and not a good idea for anything of actual importance. But there are clear hints of greatness and I think the industry just needs a bit of time"
Andrej Karpathy, Vibe coding MenuGen (2025-04-27)
Karpathy wrote this in his essay on vibe coding MenuGen. The hints of greatness are real, and so is the mess you inherit once the thing matters to someone.
Read that list of risks as your checklist. The sections below take them in the order that hurts users most: keys, payments, abuse, AI features, data you cannot get back, and finally a review of the whole app.
Stop an API key leak before it happens
An API key in your code works like a password for anyone who can see the code, and the bill or the breach lands on you. When you ask an AI tool to make a demo work, pasting the key straight into the file is the shortest path, so assume it may have happened and look. Your job is to move every key out of the code and keep the file that holds them out of every upload.
Checked fact: Anthropic's guidance: never put an API key directly in your code or configuration files, and add .env files to your ignore file so they are not uploaded.
Anthropic, Claude Help Center 'API key best practices'; GitHub Docs, 'About secret scanning'; Anthropic, Claude Code best practices, checked 2026-11-18
Checked fact: GitHub secret scanning looks for hardcoded API keys, passwords and tokens across the whole Git history of a repository, and public repositories get it automatically for free.
Anthropic, Claude Help Center 'API key best practices'; GitHub Docs, 'About secret scanning'; Anthropic, Claude Code best practices, checked 2026-11-18
Checked fact: In Claude Code a permission deny rule such as Read(./.env) stops the tool from reading the secrets file at all.
Anthropic, Claude Help Center 'API key best practices'; GitHub Docs, 'About secret scanning'; Anthropic, Claude Code best practices, checked 2026-11-18
Checked fact: A public repository is accessible to everyone on the internet; a private one only to its owner and people given access.
GitHub Docs and GitHub pricing page, checked 2026-11-18
- Search the whole project for keys and tokens, including old test scripts and config files.
- Move each one into an environment variable or your host's secret manager, and add .env to your ignore file.
- Check whether your repository is public; if nothing in it is meant to be open, make it private.
- Let GitHub secret scanning check the full history of the repository, not only today's files.
- If you work in Claude Code, add a deny rule for Read(./.env) so the agent cannot open that file at all.
If a key already leaked, revoke it before anything else
Deleting the key from your code does not make it safe, because copies stay in the Git history. The order that works is revoke first, clean up later: kill the old key at the provider and issue a new one. GitHub's docs say that scrubbing a secret out of the history is slow and often unnecessary once the credential has been revoked.
Checked fact: If a key is compromised, delete it immediately in the Console; when a Claude API key appears in a public GitHub repository, GitHub notifies Anthropic and the key is deactivated automatically.
Anthropic, Claude Help Center 'API key best practices'; GitHub Docs, 'About secret scanning'; Anthropic, Claude Code best practices, checked 2026-11-18
Principle: Audit Outbound Communication. Regularly monitor which applications are sending data from your machine to identify and remove suspicious software.
Andrej Karpathy, Digital hygiene (2025-03-17)
Karpathy's advice is to watch which programs send data off your machine and remove the suspicious ones. After a leak, turn the same habit on your app and your laptop.
- Revoke the leaked key at the provider and create a new one.
- Put the new key only in environment variables or a secret manager, never in a file you upload.
- Check the provider's billing and usage for activity you did not cause.
- List every outside service your app and your machine send data to, and remove what you cannot explain.
Keep card data and payment keys on the server
Payments are where a vibe-coded shortcut costs real money. In the payment documentation we checked, the browser only starts the payment and your server finishes it with a key the browser never sees. A checkout that works in test mode can still skip the server step, so read that part of the code yourself or ask for it to be shown to you.
Checked fact: Flow of the widget: your page loads it with a client key and shows the payment methods, the customer pays, the browser returns to your success address, and your server confirms the payment with the secret key.
Toss Payments, developer center documentation (Korean), checked 2026-11-18
Checked fact: On return, your server should check that the amount matches the amount it saved before confirming.
Toss Payments, developer center documentation (Korean), checked 2026-11-18
"You never see, touch or store any of your customer's credit card data (only a token representing them) and that's how it should be because I wouldn't trust myself to know enough about security to store credit card data anyway."
Pieter Levels, Stripe Launches Beta In The Netherlands
Levels says this about a processor that hands back a token in place of the card. Pick that kind of setup and the most sensitive data never reaches your database.
- Confirm that no payment secret key appears in your front-end code or in any file the browser downloads.
- Make the server compare the amount it saved with the amount that comes back, and refuse to confirm when they differ.
- Store only the processor's token or payment ID, never card numbers.
Expect fraud, but do not let it close your door
Handing card data to a processor does not end the payment problem. A small shop with a cheap product and a fast checkout is exactly where stolen cards get tried, and the chargebacks come back to you.
What happened: Fights card testers abusing his $29.95 software. Before Stripe existed, McKenzie spent weeks fighting a gang of criminals who ran $29.95 purchases of his software to test stolen cards before draining victims' bank accounts. With little recourse as an entrepreneur, he eventually spent dozens of hours writing code to outsmart their scripts.
Lesson: A small online seller can become a fraud testing ground, so plan your own fraud detection rather than assume the payment network will protect you.
Patrick McKenzie, Credit Cards As A Legacy System (2022-12-02)
The processor keeps cards off your server; McKenzie's lesson is that it does not keep fraud off your store, so plan some detection of your own.
Principle: Accept non-zero fraud for conversion. McKenzie holds that merchants should trade off conversion rate against fraud rate rather than minimize fraud, since every anti-fraud step also reduces the customers a business can sell to.
Patrick McKenzie, The optimal amount of fraud is non-zero (2022-09-02)
This is the counterweight. Every check you add also turns away some honest buyers, so choose the few that stop the attacks you actually see.
So treat fraud control as a dial, not a wall. Start cheap: limit how many payment attempts one account or address can make in a short time, watch for bursts of small failed charges, and look at failed payments often during your first weeks. Tighten only where you see abuse, and watch your sign-ups when you do.
Design as if some users will be malicious
Principle: Design assuming users will be evil. Atwood holds that social software must be designed from day one assuming some users will be malicious, because naive designs like trackbacks eventually make the whole community suffer.
Jeff Atwood, The Day The Trackbacks Died (2025-06-04)
Trackbacks are his example of a feature built for good-faith users that the whole community paid for once others abused it.
What happened (2024): The Podscan Email Crisis. A single user set up alerts for extremely common words, triggering thousands of emails daily. This caused the email provider to block Arvid's entire domain, stopping even critical login and password reset emails.
Lesson: One user's unintentional actions can threaten the reputation and functionality of your entire business if safeguards aren't in place.
Arvid Kahl, From Overload To Opportunity (2024-10-18)
Kahl's user meant no harm, which is the point: you need limits for honest users too. The damage reached the login and password reset emails every other user depended on.
Podcast summary: Episode 405 | Minimum Viable Security, Moving on from AuditShark, and More Listener Questions. The episode on minimum viable security makes the same case for doing just enough, starting with the basics, and for throttling and isolating a public API. (the episode's official page)
- Cap anything one user can trigger that costs you money or reputation: emails, AI calls, uploads, exports.
- Rate-limit sign-up, login and password reset so a script cannot hammer them.
- Check that every page and API route asks who the user is and returns only that user's records.
- Validate every input on the server, even when the form already checks it in the browser.
- Consider sending product emails apart from login emails, so a flood of one cannot block the other.
If your app uses AI, keep untrusted text away from its tools
Principle: Never mix untrusted text with tools. Willison holds that an LLM application must never combine untrusted input such as emails or scraped pages with access to tools or private data, because any attacker text can take control of the output.
Simon Willison, Imitation Intelligence, my keynote for PyCon US 2024
If your app reads emails, web pages or user uploads and the same model can also call tools or see private data, text written by an attacker can steer what it does.
If your app puts a model inside the product, such as a chatbot that searches user records or an assistant that sends messages, check each one against this rule. Where the model reads text you did not write, take away its tools and private data, or split the job so the part that reads the text cannot act. Test it yourself by pasting instructions into a message or a page the model will read, and see whether it obeys them.
Own your backups and prove a restore
"Don't rely on your host or anyone else to back up your important data. Do it yourself. If you aren't personally responsible for your own backups, they are effectively not happening."
Jeff Atwood, International Backup Awareness Day (2025-09-11)
A host's backup is a promise you have not checked. A copy you control is the one you can count on.
"The minimum bar for a reliable service is not that you have done a backup, but that you have done a restore ."
Joel Spolsky, Lets Stop Talking About Backups (2009-12-14)
A backup you have never restored from is a guess. Do one restore before you invite more users and see what comes back.
- Turn on automatic backups of your database and keep a second copy with a different provider.
- Restore the latest backup into a separate database and point a copy of the app at it.
- Write down how long it took and what was missing, then fix the gaps and try again.
Run a vibe coding security review before launch
Principle: Run an AI security review before launch. Willison had a frontier AI model run a security evaluation of Datasette Apps before launch, and it found a real data exfiltration attack in his CSP allow-list design.
Simon Willison, Datasette Apps: Host custom HTML applications inside Datasette
The review caught a real attack that could pull data out through his CSP allow-list design, which is why it is worth running even when you believe the app is fine.
"Luckily for us I think the attack and defense capabilities of AI models seems to somewhat match? So as long as we keep typing 'do a security audit' regularly into our clanker we can keep it safe"
Pieter Levels, Claude Code Security Audit Every Vps
Where Willison describes one review before launch, Levels treats the audit as a habit to repeat. You need both: a gate before you open the doors and a routine after.
Checked fact: A review by a fresh agent that never saw the conversation (the /code-review command in Claude Code) is not swayed by the reasoning that produced the code.
Anthropic, Claude Code best practices; GitHub Docs, Copilot best practices; Lovable and Replit documentation, checked 2026-11-18
- Ask a fresh agent, one that never saw the build conversation, to review the whole app for security.
- Give it this list: hardcoded credentials, open endpoints, unvalidated input, payment confirmation, rate limits, AI tools that read untrusted text, backups.
- Ask for evidence for each claim: the file, the line, the command it ran and its output.
- Fix the findings, then run the review again before you open sign-ups wider.
Questions people ask
What should I check first in an app built with AI?
Start with keys: make sure no API key sits in your code or in a public repository, and revoke any that did. Then check that payments are confirmed on your server, that one user cannot trigger unlimited emails or charges, and that you can restore a backup.
What do I do after an API key leak?
Revoke the key at the provider and create a new one before anything else. Removing it from the Git history is slow and often unnecessary once the old key no longer works, and GitHub secret scanning can check the whole history for others.
Is code written by AI less secure than code written by hand?
The risks are the familiar ones, such as hardcoded credentials, insecure endpoints and unvalidated input, but they are easier to miss when you did not write the code. Review and test the result yourself, and ask a fresh reviewer for evidence, not just a verdict.
Should my repository be public or private?
A public repository can be seen by everyone on the internet, so make it private unless it is meant to be open. Never upload keys either way.
Do I need to store credit card numbers to take payments?
No. A payment processor can hold the card and give you a token, and your server confirms the payment with a key the browser never sees, after checking that the amount matches.
Bring your own question
If you want to work out which of these matters most for your own app, bring a question like "Here is what my app does, what it stores and which services it calls. Which of these checks matters most for me before the next wave of sign-ups?" to The Pantheon Table. Your business and investing questions are answered there with the real words of world-class masters: https://pantheontable.com/blog/vibe-coding-security-checklist?utm_source=devto&utm_medium=social&utm_campaign=blog
The masters' words are quoted from public records, each with its source. None of them wrote, reviewed or endorses this guide.
Photo: Gladwin Analytics, CC BY 3.0. Photo: Codinghorror, CC BY 4.0.
Not affiliated with or endorsed by Andrej Karpathy, Pieter Levels or Jeff Atwood.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.

