$ cat articles/vibe-coding-app-security-claude-prompt.md
How-toยท Developmentยท Automationยท 13 min readยท Nov 23, 2026
Your weekend AI app shows its payment key in the browser. One prompt that closes this before launch
A vibe coding security check in one Claude Code prompt: 17 checks for keys, prices and passwords, fixes applied, then a hack attempt. Plus 3 manual checks.
The app you built with AI works, but that doesn't mean it can't be hacked. The holes are usually the same: a secret key sits right on the page, the order price can be changed in the browser, passwords are stored as plain text. Below is one prompt for Claude Code: it walks through 17 such spots in your project, fixes what it finds and at the end tries to hack the app itself. Claude's report doesn't replace a specialist's review, so three things are worth checking by hand afterwards, and we show which.
You built an app with AI over a weekend, and it works. We build websites for clients and regularly get security scanner reports on them. They almost always say the same thing: the admin login is open to everyone, anyone can pull the form submissions, the page runs other people's scripts. The sites are different, the holes are the same, and an app built in a chat will have them too.
Claude built something that works, but you never asked it to check whether it can be broken. What will it find if you ask it to look at the project through an attacker's eyes?
Why an app built in a chat leaks in the same places
AI builds so that things work on your screen. The shortest path there often runs through the browser: put the service key straight into the page code, calculate the order total right there, validate the form only before sending. You see a working button and don't see that the whole page code is downloaded by every visitor, and anyone can read or change it.
The most common example involves payments. The payment service Stripe has two kinds of keys. A key that starts with pk_ is safe to show: per the Stripe docs, it exists precisely for the checkout page. An sk_live_ key gives unrestricted access to everything the account can do and must live only on the server. If that key ends up in the page code, anyone can see it in the developer tools of any browser by pressing F12.
Claude can close those same spots too. It needs a list of what to check and a request to report back.
The full prompt: 17 checks before launch
Copy it as is, in one piece.
Claude, I built an app by vibe coding and I don't want it to get hacked. Before launch, check and fix:
1. API keys โ remove them from the browser, keep them only on the server.
2. Passwords โ store only as a hash (bcrypt / argon2).
3. Sessions โ only in cookies with the HttpOnly, Secure, SameSite flags.
4. Forms โ validate all data on the server, not just in the browser.
5. Database queries โ parameterized only, no string concatenation.
6. XSS โ escape everything users type in.
7. CSRF โ tokens on every form that changes something.
8. HTTPS โ everywhere, with a redirect from http.
9. Security headers โ CSP, HSTS, X-Frame-Options.
10. CORS โ allow only my own domain.
11. Rate limits on login and forms โ limit the number of attempts.
12. Admin panel โ hide it and lock it down (access only for us, 2FA).
13. Files โ check the type by content and limit the size.
14. Price and payment โ calculate only on the server, never trust numbers from the browser.
15. Debugging โ turn debug mode off in production.
16. Dependencies โ update vulnerable ones (npm audit), remove unused ones.
17. Keys in git history โ find them (gitleaks), revoke and replace leaked ones.
At the end, try to hack it yourself and give me a report: what you found and what you fixed.Replace: nothing, the prompt fits any web app. If the project has no admin panel, payments or file uploads, Claude will mark those items as not applicable on its own.
Result: Claude goes through the project item by item, edits files and at the end gives a two-column report: what it found and what it fixed.
How to run the check in Claude Code
The prompt is meant for Claude Code, the version of Claude that works with your project files directly on your computer. In a regular chat it won't see the whole codebase. If so far you've only built in the chat, we explained how the chat differs from the terminal and how to switch in the guide to three ways of working with Claude.
- 1
Save the current version
If the project is in git, make a commit before the check. Claude will change a lot of files, and this way any edit can be rolled back with one command.
- 2
Open the project root
Start Claude Code in the main project folder, where package.json or the README lives. From a subfolder it will only see part of the project.
- 3
Paste the prompt
Copy the prompt above in full and send it as one message.
- 4
Read what it asks for
Claude will ask permission for commands and edits. Say yes to reading and checks, but look carefully at deleting files and changing the database.
- 5
Keep the report
At the end, ask it to save the report to a SECURITY-REPORT.md file so you can come back to it before the next launch.
Don't expect a verdict like โsafe or notโ in the report, expect a list: which file had what and what it became. For example, the key moved from the page code into environment variables on the server, the login form got an attempt limit, debug mode is off in the production settings. Where Claude can't fix something itself (revoking a key in the service dashboard, turning on HTTPS at your host), it will write what you need to do.
You passed the check. Next: an app you're not afraid to show people
You ran your project through 17 checks and closed the most dangerous holes. In the course โFrom Chat to Appโ you build a project with Claude Code from scratch and keep it in order as you go: permissions, git and undo, publishing it online.
- Course โFrom Chat to Appโ: the lesson โSafety & Control: Permissions, Git, and Undoโ
- A ready library of working prompts
- AI mentor in every lesson
- New courses at no extra cost
$44.90one time
Get full accessNo subscription. Lifetime access, future courses included.
Keys, passwords and login
Next, briefly, what each item means, so you understand Claude's report. Read only the groups that apply to your app: if there's no password login, you can skip this one.
- 1
API keys
The key lives on the server, in environment variables. The page only gets the result of the request, never the key itself.
- 2
Passwords
If the database leaks, the passwords must not be readable. A hash is a one-way fingerprint of a password: you can compare against it but not recover the password. OWASP, the main open rulebook for web security, recommends Argon2id first and keeps bcrypt for legacy systems.
- 3
Sessions
The cookie that tells the site you're logged in. HttpOnly hides it from scripts on the page, Secure sends it only over an encrypted connection, SameSite stops another site from sending it on your behalf.
- 4
Attempt limits
Without one, the login form can be hammered with passwords all night. With one, after a few failures login slows down or locks for a while.
- 5
Admin panel
An address like /admin is tried by every automated scanner. Access only for your own people plus a second factor, a code from an app on your phone, keeps it closed even to someone who guessed the password.
Everything the browser sends
The main rule of this group: anything that came from the browser could have been written by anyone. An example worth remembering: the product card says 4990, but the request to the server, edited in the developer tools, says 1. If the server takes the amount from the request, the order goes through for 1. So the server calculates the price itself, from its own database, and re-checks everything else the page sent the same way.
- 1
Forms
Validation in the browser is for convenience, not protection: it can be switched off in a minute. The server checks every field again.
- 2
Database queries
If text from a form is pasted straight into a database query, someone can type a command into the field instead of a name. A parameterized query passes the input separately, and the command stays plain text.
- 3
XSS
Someone writes a script into a comment, and it runs for everyone who opens the page. Escaping turns it into harmless characters.
- 4
CSRF
Another site quietly submits a form to yours on behalf of a logged-in user, for example changing their email. A one-time token in the form proves it was opened on your site.
- 5
Files
It's easy to name a program as an image with a .jpg extension. The type is checked by content, and the size is limited so nobody fills your server with gigabytes.
- 6
Price and payment
Total, discount and quantity are calculated on the server. The browser only sends what the buyer chose.
The server, headers and what's left in history
This is the least obvious item. If a key was ever saved in the project history (that's what git is), erasing it from there isn't enough: per the GitHub docs, copies remain with everyone who downloaded the project. So a leaked key is first revoked in the service dashboard and a new one is issued. That's on you; Claude will tell you where.
- 1
HTTPS
Without it, passwords and card details travel over the network as plain text. The redirect from http makes old links lead to the secure version too.
- 2
Security headers
Short instructions from the server to the browser. CSP lists where the page may load scripts from, and it's the main defense against XSS. HSTS forbids opening the site without encryption. X-Frame-Options stops anyone from hiding your site as an invisible layer inside their page. CSP is one of the headers we add for clients after scanner reports.
- 3
CORS
The rule for which other sites the browser lets read your server's responses. An asterisk, โeveryoneโ, is convenient while building and dangerous after launch.
- 4
Debug mode
In production it shows visitors detailed errors with file paths and sometimes settings. That's a hint for an attacker.
- 5
Dependencies
Your app stands on other people's packages, and they have their own. npm audit checks them against a database of known vulnerabilities, npm audit fix updates what can be updated without breaking things.
- 6
Keys in git history
Gitleaks goes through all old commits and shows where keys and passwords sit. For each one found: revoke, replace, then clean the history.
What to check by hand after the report
Claude checks the code it can see, and it checks its own work. We think that for an app with no payments and no other people's data, this report is enough for a first launch. If there's money or personal data, the report is a good cleanup before an audit, not the audit itself. Three checks that take little time:
# 1. Headers: open securityheaders.com and enter your site address# 2. Dependencies, in the project root:npm audit# 3. Secrets across the whole git history (macOS: brew install gitleaks):gitleaks git -v
securityheaders.com shows which headers are missing on the live address, not in the code. npm audit will flag anything that changed after the check. Gitleaks will go through all the old commits Claude may not have looked at; if the commands seem complicated, ask Claude Code to run them for you and explain the output.
Where to start today
If the app is already open to people, start with two items: keys and price. Those cost money from day one. Claude will go through the other fifteen in the same run, and by evening you'll have a list: what was open and what is closed now.
Next stepMastering Claude Code: From Zero to Power UserThe next step after a one-time check: hooks and permission settings, so Claude Code keeps your security rules in every session on its own.Open the courseVersions and prices as of 23 November 2026
OWASP recommendations, gitleaks and npm commands and Claude Code features change. Check their documentation for the current state.
Sources9expand
- Stripe, โAPI keysโ, checked 23.11.2026 โ https://docs.stripe.com/keys
- GitHub, โRemoving sensitive data from a repositoryโ, checked 23.11.2026 โ https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository
- OWASP, โPassword Storage Cheat Sheetโ, checked 23.11.2026 โ https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html
- OWASP, โOWASP Top 10:2025โ, checked 23.11.2026 โ https://top10.owasp.org/
- MDN, โContent Security Policy (CSP)โ, checked 23.11.2026 โ https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP
- MDN, โSet-Cookieโ, checked 23.11.2026 โ https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie
- gitleaks, README, checked 23.11.2026 โ https://github.com/gitleaks/gitleaks
- npm, โnpm auditโ, checked 23.11.2026 โ https://docs.npmjs.com/cli/commands/npm-audit
- Anthropic, โClaude Code: Securityโ, checked 23.11.2026 โ https://code.claude.com/docs/en/security
$ grep tools: articles/vibe-coding-app-security-claude-prompt.md
Tools from this piece
Each has its own card: check date, stars and a short verdict.
GitHub repository58kFreeLLMAPIA free router that pools the free tiers of 34 LLM providers behind one API key. Claude Code keeps working on Gemini, Groq or DeepSeek when your limit runs out.
GitHub repository65kCLI-AnythingTurns an ordinary program like GIMP, Blender or LibreOffice into a set of commands an AI agent can use on its own, without screenshots or clicks. There is a catalogue of ready-made ones, and you can build your own with one command in Claude Code. Apache-2.0.$ ls articles/ --related



Comments