You Built It in a Weekend. Take 10 Minutes to Secure It.
AI coding tools are incredible. You describe what you want and Cursor, Bolt, Lovable or Replit Agent builds it. In a weekend you have a working SaaS product with authentication, a dashboard, payment processing and a deployment pipeline.
What you do not have is security. AI coding tools optimize for making features work, not for making them safe. Every vibe coded application we have audited at Sherlock Forensics has had critical vulnerabilities.
These seven prompts will not replace a professional security audit, but they will catch the most dangerous issues before you ship. Copy each one, paste it into your AI coding tool and fix what it finds. Ten minutes per prompt could save you from a data breach.
For the full library of 25+ prompts covering every security category, visit our AI Security Prompt Library.
What Is Vibe Coding Security?
Vibe coding security is the practice of checking AI-generated code for vulnerabilities before you deploy it. AI coding tools are built to produce working code, not secure code, so they routinely ship broken authentication, injection flaws and hardcoded secrets. The seven prompts below catch the highest-risk issues in about ten minutes, before your app goes live.
Prompt 1: Authentication Audit
Authentication is the front door of your application. AI tools build login flows that look complete but miss critical security requirements. This prompt catches the gaps.
Review my authentication implementation for security vulnerabilities. Check for: plaintext password storage (must use bcrypt/scrypt/argon2 with cost factor >= 10), missing rate limiting on login endpoints, JWT tokens without expiration or with expiration longer than 24 hours, session tokens that persist after logout, password reset links that do not expire within 1 hour and missing CSRF protection on login forms. List each issue found with severity (critical/high/medium) and the exact code change needed to fix it.
Why this matters: We find plaintext or weakly hashed passwords in over 60% of vibe coded applications. If an attacker gets your database, every user's password is immediately compromised.
Prompt 2: Authorization Check
The most dangerous vulnerability in vibe coded apps is not broken authentication. It is missing authorization. The app checks whether someone is logged in but never checks whether they should access the specific resource they requested.
Review all API endpoints in my application for authorization vulnerabilities. For each endpoint check: does it verify the authenticated user has permission to access the specific resource requested (not just that they are logged in), does it prevent horizontal privilege escalation (User A accessing User B's data by changing an ID), does it prevent vertical privilege escalation (regular user accessing admin endpoints) and are all sensitive operations protected by authentication? List every endpoint with its current authorization status and the fix needed.
Why this matters: Broken access control has been the number one vulnerability on the OWASP Top 10 since 2021. In vibe coded apps, it is trivially exploitable by simply changing an ID parameter in a URL.
Prompt 3: Secrets Scanner
AI tools put API keys wherever is fastest. In vibe coded apps, that usually means client-side JavaScript that ships to every browser.
Search my entire codebase for hardcoded secrets, API keys and credentials. Look for: strings that match API key patterns (sk_, pk_, key_, token_, secret_), database connection strings with embedded passwords, AWS access keys (AKIA...), private keys or certificates stored in code, .env files committed to the repository and any configuration files that contain credentials. For each finding, show the file, line number and a secure alternative using environment variables.
Why this matters: An attacker can find your Stripe, OpenAI or Supabase keys in seconds using browser developer tools. Once they have them, they can charge your accounts, access your data and impersonate your application.
Prompt 4: SQL Injection Detection
Every vibe coded app we have tested with a relational database has at least one SQL injection vulnerability. AI tools generate database queries using string concatenation because it is the fastest way to build a working query.
Audit all database queries in my application for SQL injection vulnerabilities. Find every query that uses string concatenation or template literals to include user input. Replace each one with parameterized queries or prepared statements. Also check for: NoSQL injection in MongoDB queries, ORM misuse that bypasses parameterization and any raw query functions that accept user-controlled input. Show the vulnerable code and the fixed version side by side.
Why this matters: A single SQL injection vulnerability can give an attacker full access to your database. They can read, modify or delete every record.
Prompt 5: Security Headers
Security headers are free protection that AI tools almost never configure. They instruct browsers to enable built-in defenses against XSS, clickjacking and content sniffing.
Review my deployment configuration for security issues. Check that: debug mode is disabled in production, error messages do not expose stack traces or internal paths, source maps are not deployed to production, environment variables are used for all secrets (none hardcoded), the deployment uses HTTPS with a valid certificate, HTTP Strict Transport Security (HSTS) is enabled and the server returns security headers including Content-Security-Policy, X-Frame-Options, X-Content-Type-Options and Referrer-Policy. Show me the exact configuration needed for my hosting platform.
Why this matters: Without security headers, your users are vulnerable to clickjacking, XSS and man-in-the-middle attacks, even if your application code is otherwise secure.
Prompt 6: Dependency Verification
AI tools hallucinate package names. Attackers register the fake names with malicious code. This is a real, active attack vector.
Audit all dependencies in my package.json (or requirements.txt or composer.json). For each dependency check: does this package actually exist on the official registry (npm, PyPI, Packagist), is the package name spelled correctly (check for typosquatting), does the package have a reasonable number of downloads and a maintained repository, are there any known vulnerabilities reported in the package (check npm audit, pip-audit or similar), is the version pinned to avoid unexpected updates and are there any packages that could be replaced with built-in language features? Flag any suspicious or unnecessary dependencies.
Why this matters: Installing a hallucinated or typosquatted package can give an attacker code execution on your server and every machine that builds your project.
Prompt 7: Error Handling Review
AI tools leave debug mode enabled because it helps during development. When you deploy to production, those detailed error messages become a roadmap for attackers.
Review my application's error handling for information disclosure vulnerabilities. Check that: production error responses return generic messages (not stack traces, file paths or database schemas), API errors return consistent JSON format with appropriate HTTP status codes, unhandled exceptions are caught by a global error handler, error logging captures full details server-side without exposing them to the client, database error messages are not passed through to users and custom error pages are configured for 404, 403 and 500 responses. Show every location where detailed errors could leak to users and provide the secure error handling pattern for my framework.
Why this matters: Verbose error messages reveal your database schema, file structure, framework version and internal logic. Attackers use this information to craft targeted exploits.
These Are a Start, Not a Finish
These seven prompts catch the most common and most dangerous vulnerabilities in vibe coded applications. They are a strong first pass that takes less than an hour to complete. If you are new to this space, our guide on what vibe coding is and why it matters covers the fundamentals. For a complete secure workflow beyond prompts, read how to vibe code securely.
They are not a substitute for a professional security audit. Prompts cannot detect business logic flaws, complex authorization bypasses or architecture-level vulnerabilities that require human analysis to identify.
For the full library of 25+ prompts covering authentication, API security, database hardening, deployment, input validation, session management and more, visit our AI Security Prompt Library.
When you are ready for the thorough review, scope a vibe coding security audit starting at $1,500 USD. Compare unified pricing across the Sherlock Forensics tool catalog at /pages/pricing.html.
Five More Checks
The seven prompts above cover the highest-risk gaps. These five cover the next layer. Paste each into the same AI tool with your code.
Input Validation
Injection starts wherever user input reaches a sensitive operation unchecked.
List every endpoint or function that accepts user input. For each one, tell me what validation is applied on the server. Flag any input that reaches a database query, file operation or shell command without validation.
Red flag: user input that reaches a query, a file path or a shell command with no server-side check. Fix: validate at every entry point against an allowlist of expected formats.
File Upload Security
An upload form that accepts any file can become a way to put a script on your server.
Does this application accept file uploads? If so, does it validate file types on the server side, limit file sizes, rename uploaded files and store them outside the web root? List anything missing.
Red flag: client-side-only type checks, original filenames kept or uploads stored in a public directory. Fix: validate type and size on the server, rename every file and store uploads outside the web root.
Exposed Admin Routes
AI tools often build an admin panel and forget to lock it.
List every route or endpoint in this application. For each admin or internal route, tell me what authentication and authorization checks protect it. Flag any admin route that is reachable without authentication or without an admin role check.
Red flag: routes such as /admin, /dashboard or /api/internal with no auth middleware. Fix: require authentication and a role check on every admin route.
CORS Configuration
A loose cross-origin policy lets another site call your API with your users' sessions.
What is the CORS configuration for this application? Does it reflect the request origin? Does it allow credentials? Which origins are allowed for each API?
Red flag: the server reflects any request origin with credentials allowed. A wildcard origin on a private API is the same mistake. Fix: allowlist the specific origins that need access.
Insecure Randomness
Tokens built from a non-cryptographic random source can be predicted.
Find every place this code generates random values. Is it using Math.random(), random.random() or any non-cryptographic source for tokens, session IDs, reset links or passwords?
Red flag: Math.random() or random.random() behind any security value. Fix: use crypto.getRandomValues() or crypto.randomBytes() in JavaScript and the secrets module in Python.
What Vibe-Coded Apps Get Wrong
AI tools are tuned to make features work. When nobody asks for security, the AI does not volunteer it. The same five gaps recur:
- Authentication that exists but is incomplete
- The login works, but tokens do not expire, password reset links stay valid and login attempts are not rate-limited.
- Authorization that is missing
- The app checks that a user is logged in but not whether that user may see the record. Change an ID in the URL and another user's data appears.
- API keys in client-side code
- Stripe, OpenAI and Supabase keys end up in JavaScript that ships to every browser.
- Queries built by string concatenation
- They work with expected input and break on a single quote.
- Error messages that expose internals
- Debug mode left on leaks stack traces, schemas and file paths.
Why a Scanner Is Not Enough
Automated scanners match patterns. They find basic SQL injection and some exposed keys. They do not know your authorization model, so they cannot tell that User A should not see User B's invoices or that a payment path skips verification. Broken access control is the top risk in the OWASP Top 10. Finding it takes a person who understands what the app is supposed to allow.
Secure the Workflow Around the Prompts
Prompts check code after it is written. Four habits stop the same mistakes from being written in the first place.
Keep Secrets Out of Code From Day One
Create a .env file for local development and add it to .gitignore before the first commit. Tell your AI assistant to reference process.env.DATABASE_URL instead of the real connection string. Commit a .env.example with the variable names and no values. In production use a secrets manager such as AWS Secrets Manager, HashiCorp Vault, Doppler or your host's environment variables. Our secure vibe coding setup guide walks through it.
Put Security Rules in Your Project Instructions
- Never hardcode secrets, API keys or credentials. Use environment variables.
- Use parameterized queries for every database operation.
- Validate and sanitize all user input on the server.
- Generate tokens with a cryptographic source, never
Math.random(). - Set Content-Security-Policy, X-Frame-Options and Strict-Transport-Security headers.
- Rate-limit authentication endpoints.
Install Pre-Commit Hooks
Pre-commit hooks run every time you commit and block the commit when they find a problem. gitleaks or detect-secrets catch keys and passwords. npm audit or pip-audit catch packages with published vulnerabilities. Semgrep, Bandit for Python or ESLint security plugins catch patterns such as eval() and SQL concatenation.
Check Before You Deploy
- Run a full dependency audit and fix every high and critical finding.
- Check your production headers with securityheaders.com.
- Test authentication by hand: log out, open protected pages, try another user's record.
- Search the browser's network tab and JavaScript bundle for anything that looks like a key.
- Trigger errors on purpose and confirm no stack traces or file paths come back.
Frequently Asked Questions
What security prompts should I use when coding with AI?
Use prompts that enforce server-side authentication, parameterized queries, environment variable secrets management and rate limiting on sensitive endpoints. Sherlock Forensics publishes a free library of 25+ tested security prompts. For a comprehensive audit, vibe code pentests start at $1,500 USD.
How do I make Cursor or Copilot generate secure code?
Prepend security-focused system prompts to every AI coding session. Instruct the AI to use parameterized queries instead of string concatenation, store secrets in environment variables, implement server-side authentication and add rate limiting. Even with prompts, AI-generated code still requires manual security review before deployment.
What are the biggest security risks of vibe coding?
The top risks are hardcoded API keys in client-side code, authentication that only runs in the browser, SQL injection from string-concatenated queries, hallucinated npm or PyPI packages and missing authorization checks on API endpoints.
Is vibe coding inherently insecure?
No. The risk comes from shipping AI-generated code without review, not from using AI to write it. With secrets kept out of code, security rules in the project instructions, pre-commit hooks and a review before launch, a vibe-coded app can be as secure as one written by hand.
What are pre-commit hooks and why do vibe coders need them?
Pre-commit hooks are scripts that run before code is committed to version control. They catch hardcoded secrets, vulnerable dependencies and risky code patterns before the code enters the repository. For vibe coders they act as an automated reviewer that needs no security background.
