Vibecode Project Security — 11 Checks with Claude
AI writes code that works. However, working is not the same as secure: API keys end up exposed in client-side code, the admin panel is accessible via direct URL, and anyone can view another user's orders simply by changing a number in the address bar. Go through these checks in order, ideally inside Claude Code opened in your project directory.
Vibecode Project Security — 11 Checks with Claude
// SECURITY · VIBECODE · 11 CHECKS
What’s Inside
11 checks that patch the most common security holes in AI-built projects.
A Claude Code prompt for each check: copy, paste, and review the report.
How to verify the results yourself, with zero coding knowledge.
One master prompt to run the full audit at once.
AI writes code that works. However, working is not the same as secure: API keys end up exposed in client-side code, the admin panel is accessible via direct URL, and anyone can view another user's orders simply by changing a number in the address bar. Go through these checks in order, ideally inside Claude Code opened in your project directory.
Before You Start
Save your current version: Ask Claude to "commit all changes" or back up your project folder.
Go one step at a time: Have Claude report what it finds first before making any edits.
Test after every fix: Open your site and make sure everything still works as expected.
Start by running the
/security-reviewcommand in Claude Code: it scans recent project changes for vulnerabilities and lists its findings. Then proceed through the deeper checks below.
1. Hide Your API Keys
An API key is a password to a paid service: OpenAI, Claude, Stripe, or your database. If it sits in your frontend code, any visitor can see it via "View Page Source" and rack up charges on your dime.
Prompt:
Find all API keys, tokens, and passwords hardcoded in the project. Show the file and line number for each. Move them into environment variables (.env) and verify that no secret key ends up in code shipped to the browser. Do not delete anything without my confirmation.
(Copy prompt)
Note: In Next.js, variables prefixed with NEXT_PUBLIC_ are exposed to the browser; in Vite, the prefix is VITE_. Any secret key using these prefixes is visible to everyone.
2. Check Environment Variables
Your .env file stores secrets. It must never be committed to Git or exposed in plain text on your hosting provider.
Prompt:
Verify that .env and all files containing secrets are listed in .gitignore and have never been committed to Git history. Create an .env.example file listing the variable names without values. Tell me which variables I need to configure in my hosting dashboard.
(Copy prompt)
3. Lock Down Admin Routes
The admin panel houses pages and endpoints that view, modify, or delete all users. A classic mistake: hiding the admin button in the UI while leaving the page itself open via direct URL.
Prompt:
Find all admin pages and API routes. Verify that every single one checks the user's role on the server rather than just hiding the UI button. Verify that users cannot assign themselves an admin role during registration. Show me any unprotected routes.
(Copy prompt)
4. Set Up Proper Authentication
Authentication verifies that a user is actually who they claim to be.
Prompt:
Audit login and registration: ensure passwords are stored strictly as hashes (bcrypt or argon2), sessions are stored in cookies with HttpOnly, Secure, and SameSite flags, logging out terminates the session, and password resets use short-lived, single-use links. If authentication is custom-built, recommend an established solution to replace it.
(Copy prompt)
5. Restrict Access to User-Owned Data
The single most common vulnerability in vibecoded apps: a user changes /orders/125 to /orders/126 in the URL and sees someone else's order.
Prompt:
Check every query that reads or modifies data: the server must verify that the record belongs to the currently authenticated user. Find places where records are fetched solely by an ID from the URL or request payload. If the project uses Supabase, verify that Row Level Security (RLS) is enabled on all tables and that policies do not expose other users' rows.
(Copy prompt)
Note: The Supabase anon key is meant to be public. RLS policies are what actually protect your data—without them, any visitor can read the entire table.
6. Sanitize Forms & Prevent XSS
Cross-Site Scripting (XSS) happens when someone injects malicious code into a form field, and your site executes it for other visitors—stealing logins or hijacking the page.
Prompt:
Find all forms and text inputs. Verify that data is validated on the server, not just in the browser. Find places where user input is rendered as raw HTML (innerHTML, dangerouslySetInnerHTML, v-html) and sanitize it with DOMPurify or render it as plain text. Verify that database queries are parameterized and contain no raw SQL string concatenation.
(Copy prompt)
7. Add Rate Limiting
A rate limit caps how many requests one person can send per minute. Without it, attackers can brute-force passwords or drain your AI API budget in seconds.
Prompt:
Add rate limiting to login, registration, password reset, form submissions, and all routes calling paid APIs. Suggest sensible limits for each and show what the user will see when a limit is exceeded.
(Copy prompt)
8. Audit All API Endpoints
Endpoints are the URLs your app sends requests to. Anyone can call them directly, bypassing your UI entirely.
Prompt:
Build a table of all API routes in the project: HTTP method, path, whether authentication is required, and who is allowed to call it. Flag any routes missing auth or permission checks. Verify that error responses never leak internal details like database queries, file paths, or keys.
(Copy prompt)
9. Configure CORS
CORS controls which external websites are permitted to call your API from a browser.
Prompt:
Check the CORS configuration. Only my own domains should be allowed. Using a wildcard (*) alongside credential/cookie transmission is unacceptable. Show the current settings alongside the corrected version.
(Copy prompt)
10. Turn Off Debug Mode in Production
When an error occurs, debug mode exposes code snippets, configuration settings, and sometimes secret keys. Production is the live version of your site that real users visit.
Prompt:
Verify that debug mode (DEBUG, debug mode, dev server) is disabled in production, detailed stack traces are hidden from users, and source maps are not publicly exposed. Show me where this is configured.
(Copy prompt)
11. Scan for Exposed Files & Leaked Secrets
Sometimes /.env, /.git, or database backups are publicly downloadable from the web server. Furthermore, any key ever committed to Git remains in the commit history even after you delete it from the code.
Prompt:
Check whether the server exposes internal files: .env, .git, backups, database dumps, or logs. Next, scan the entire Git history for secrets using gitleaks. For every key found, tell me which service to rotate it in. Do not rewrite Git history without my confirmation.
(Copy prompt)
Important: Deleting a leaked key from your code isn't enough—you must revoke it and generate a new one in the service dashboard, or anyone who found it in Git history can keep using it.
One Prompt for Everything
If you want to run everything in one go, paste the prompt below. Claude will compile a report and wait for your confirmation before making edits.
Prompt:
Run a full security audit on this project. Check: 1) API keys and passwords in server and client-side code; 2) .env and .gitignore; 3) admin route protection and role assignment; 4) authentication, password hashing, and sessions; 5) data access controls (IDOR, Row Level Security); 6) form validation, XSS, and SQL injection; 7) rate limiting; 8) all API endpoints for auth and permissions; 9) CORS; 10) production debug mode and source maps; 11) exposed internal files and secrets in Git history. Output a table with columns: Issue, Location, Severity, and How to Fix. Start with the most critical vulnerabilities. Do not make any changes until I confirm.
(Copy prompt)
Verify It Yourself
Open your site in an Incognito window and paste the admin URL—you should be blocked or redirected to login.
Log in with a second account and swap the record ID in the URL—the other user's data must not load.
Append
/.envand/.git/configto your site's URL—both must return a404or403error.Right-click on the page → View Page Source and search (
Ctrl+F/Cmd+F) forsk-andkey—no secret keys should appear.
Learn more about common web application vulnerabilities in the OWASP Top 10.
Done When:
Zero secret keys exist in your codebase or Git history, and any previously leaked keys have been rotated.
Admin pages and other users' data cannot be accessed via direct URL.
Forms are validated on the server, and logins plus paid API calls are rate-limited.
Debug mode is turned off in production and no internal files are publicly accessible.