# Vibe coding security checklist: secure AI code before deploy

> A vibe coding security checklist for AI-generated apps: secrets, auth, database access, dependencies, deploy config, server isolation, monitoring and rollback.

Source: https://zopanel.net/blog/vibe-coding-security-checklist  
Updated: 2026-11-09

## Key takeaways

- Broken access control is first in the OWASP Top 10:2025, and it is easy to miss in AI-generated apps because the code is tested only by the user who wrote the prompt.
- Anything in a VITE_ or NEXT_PUBLIC_ variable is inlined into the browser bundle at build time, so it must never hold a secret.
- Supabase says to enable Row Level Security on every table in an exposed schema and to keep the secret or service role key server-side, because it bypasses RLS.
- The hosting layer can contain a compromised app, filter common attacks and roll back a bad release, but it cannot fix missing authorization checks in your code.

A vibe coding security checklist covers seven areas before an AI-built app goes public: keep secrets out of the code and the browser bundle, check authorization on every request and database row, validate input and use parameterized queries, audit the dependencies the AI added, ship a production configuration, run the app isolated on the server, and keep logs and a one-click rollback. Most of it takes an afternoon, and the most important item, authorization, is the one no hosting platform can do for you.

The list below is grouped so you can work through it in order, with each item tied to a verifiable source: the [OWASP Top 10:2025](https://top10.owasp.org/2025), the [OWASP Top 10 for LLM Applications](https://genai.owasp.org/llm-top-10/), and the documentation of the tools involved.

## Why does AI-generated code need its own checklist?

Code generated from prompts is tested by the person who wrote the prompt, logged in as themselves, on the happy path. That catches crashes, not missing checks. The failures that matter show up when someone else sends a request: another user's ID in the URL, a direct call to an API route, a key read from the JavaScript bundle.

Those map directly onto the OWASP Top 10:2025, where **A01 Broken Access Control** is first, followed by **A02 Security Misconfiguration** and **A03 Software Supply Chain Failures**. Even the builders say so: Replit publishes its own [security checklist for vibe coders](https://docs.replit.com/tutorials/vibe-code-security-checklist), covering server-side API keys, authorization checks and rate limiting.

Tip: you can ask the AI to review its own work, but ask specific questions ("show every route that reads `params.id` and where it checks ownership"), not "is this secure?", and verify the answers.

## 1. Secrets

- **No secret in the repository.** Search for keys before the first push: `git grep -nE "sk_live|sk-|service_role|PRIVATE KEY|password\s*="`. A dedicated scanner such as [gitleaks](https://github.com/gitleaks/gitleaks) catches more patterns.
- **No secret in a public variable.** Vite [warns](https://vite.dev/guide/env-and-mode) that `VITE_*` variables are exposed in client-side code and "should not contain sensitive information such as API keys". Next.js [inlines](https://nextjs.org/docs/app/guides/environment-variables) `NEXT_PUBLIC_*` values into the JavaScript sent to the browser at build time. Open your built bundle and search it for your key prefixes.
- **`.env` is ignored.** Check `.gitignore` contains `.env*` and commit a `.env.example` with names only.
- **Turn on secret scanning.** GitHub [scans the entire Git history on all branches](https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning) of public repositories for free. [Push protection](https://docs.github.com/en/code-security/secret-scanning/introduction/about-push-protection) blocks a push that contains a known secret type; at repository level it is off by default, and for private organization repositories it needs GitHub Secret Protection.
- **Rotate anything that ever leaked.** Deleting the line does not remove it from Git history. Revoke the key at the provider and issue a new one.
- **Keep server-only keys on the server.** Payment, email and AI provider keys belong in server code or server functions, never in a component that runs in the browser.

## 2. Authentication and authorization

- **Use an established auth library or service**, not hand-written password handling. If you must store passwords, hash them with a slow algorithm made for passwords.
- **Check authorization on every request, not only on the page.** The Next.js [data security guide](https://nextjs.org/docs/app/guides/data-security) is blunt: a Server Action "is reachable via a direct POST request, not just through your application's UI", and "a page-level authentication check does not extend to the Server Actions defined within it". The same is true of every API route in every framework.
- **Check ownership, not just login.** Loading `/api/invoices/123` must confirm invoice 123 belongs to the caller. This is the Insecure Direct Object Reference the Next.js guide warns about, and the core of OWASP A01.
- **Enable Row Level Security if the browser talks to Supabase.** Supabase's [RLS guide](https://supabase.com/docs/guides/database/postgres/row-level-security) says to "enable RLS on every table in an exposed schema"; a table without it is open to any role holding a grant. Once RLS is on, nothing is readable with the publishable key until you write policies, so write one per operation and test it as a second user.
- **Never ship the secret or service role key.** Supabase: it has full access and "bypasses RLS, so keep it server-side". The publishable key is [safe in the browser](https://supabase.com/docs/guides/api/api-keys) only because RLS limits what it reaches.
- **Test as a stranger.** Create a second account and try to read, change and delete the first account's data through the UI, then through the API with `curl`.
- **Admin pages need a server check**, not a hidden menu item or an `isAdmin` query parameter.

## 3. Input and database

- **Parameterized queries or an ORM only.** Search for SQL built with string concatenation or template strings that are not the library's safe tagged template.
- **Validate input on the server** with a schema library (Zod, Pydantic): types, lengths, allowed values. Client-side validation is a convenience, not a control.
- **Return only what the UI needs.** Do not send whole database rows to the client; the Next.js guide recommends returning small data objects.
- **Escape output.** Avoid `dangerouslySetInnerHTML` or `v-html` with user content; if you must render HTML, sanitize it.
- **Uploads:** check type and size on the server, rename files, and store them outside the code folder.
- **Rate-limit login, signup, password reset and anything that sends email or calls a paid API.** Replit's checklist lists rate limiting for authentication routes; [OWASP LLM10 Unbounded Consumption](https://genai.owasp.org/llm-top-10/) covers the bill you get when an AI endpoint is not limited.

## 4. Dependencies

AI assistants add packages freely, and supply chain failures are A03 in the 2025 list.

- **Check every package the AI added exists, is the one you meant, and is maintained.** Look it up on npm or PyPI before installing; a misspelled or invented name may belong to someone else.
- **Commit the lockfile** and install with `npm ci` so the server builds exactly what you tested.
- **Run an audit.** `npm audit` [reports known vulnerabilities](https://docs.npmjs.com/cli/v11/commands/npm-audit) and exits non-zero when it finds them, so it can fail a CI job; `npm audit signatures` verifies registry signatures and provenance. For Python, `pip-audit` does the same job.
- **Turn on Dependabot alerts** for the repository so new advisories reach you ([GitHub docs](https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts)).

## 5. Deployment configuration

- **Production mode.** `NODE_ENV=production`, Django `DEBUG=False`, Flask without the debugger. Debug pages leak stack traces, settings and sometimes secrets.
- **Generic error messages** to users, details in the logs.
- **HTTPS only**, with HTTP redirected, and cookies set `Secure`, `HttpOnly` and `SameSite`.
- **Security headers:** at least `Strict-Transport-Security`, `X-Content-Type-Options: nosniff` and a framing policy; add a Content Security Policy when you can.
- **CORS:** never `*` with credentials; list your real origins.
- **No dev tools in production:** remove seed routes, test users, `/api/debug` endpoints and admin panels without a login.
- **Bind the app to `127.0.0.1`** behind a reverse proxy instead of exposing the app port to the internet.

## 6. Server and hosting isolation

- **Run the app as its own unprivileged user**, never as root.
- **Limit its CPU, memory and processes** so a runaway loop or a flood does not take down everything else on the server.
- **Build untrusted code with the same limits.** A build runs install scripts from every dependency: it should not be able to write outside the app's folder.
- **Keep the OS patched** and SSH key-only ([securing an Ubuntu VPS](/blog/secure-ubuntu-vps)).
- **Firewall everything except 80, 443 and SSH**; databases listen on localhost.
- **Separate projects.** One experiment should not be able to read another app's files or `.env` ([shared hosting account isolation](/blog/shared-hosting-account-isolation)).

## 7. Monitoring and rollback

- **Keep access and error logs**, and look at them in the first days after launch.
- **Uptime checks** and an alert when a deploy fails ([uptime monitoring](/blog/uptime-monitoring-status-page)).
- **Back up the database** on a schedule, off the server, and test a restore once ([backup strategy](/blog/website-backup-strategy)).
- **Make rollback one action.** When an AI-generated change breaks production, you want the previous release back in seconds, then fix forward.
- **Health-check releases** so a build that does not start never replaces a working one.

## If your app calls an LLM, add these

Apps that send user input to a model have their own risks, listed in the [OWASP Top 10 for LLM Applications 2025](https://genai.owasp.org/llm-top-10/):

| OWASP LLM risk | What to check |
| --- | --- |
| LLM01 Prompt Injection | User text and fetched documents can override your instructions. Never let the model's output alone authorize an action. |
| LLM02 Sensitive Information Disclosure | Do not put other users' data or secrets into the prompt context. |
| LLM05 Improper Output Handling | Treat model output as untrusted input: escape it before rendering, never pass it to SQL or a shell. |
| LLM06 Excessive Agency | Give tools the narrowest permissions; require a confirmation for anything that writes, pays or sends. |
| LLM07 System Prompt Leakage | Assume the system prompt will be read; keep keys and rules that matter out of it. |
| LLM10 Unbounded Consumption | Per-user limits on requests and tokens, and a spending cap at the provider. |

## What can the hosting layer protect, and what can't it?

Hosting is the last line, not the first. Be clear about which list each item is on:

| The hosting layer can | The hosting layer cannot |
| --- | --- |
| Keep a compromised app inside its own user, files and resource limits | Notice that `/api/orders/42` returns someone else's order |
| Block many SQL injection, XSS and scanner requests with a WAF | Fix an SQL query built from strings (it only blocks some attacks against it) |
| Serve HTTPS and renew certificates | Remove a key that is already in your JavaScript bundle |
| Stop a release that fails its health check, and roll back a bad one | Tell a release that passes the health check from one with a logic bug |
| Verify that a deploy webhook really came from your Git host | Decide whether a dependency is trustworthy |
| Keep logs, backups and alerts | Write Supabase RLS policies for you |

The right-hand column is sections 1 to 4 of this checklist. A good host makes a mistake smaller; only review makes it go away.

## How ZoPanel helps

ZoPanel is a hosting control panel you install on your own VPS. It assumes, as its [vibe coding page](/vibe-coding) puts it, that generated code is code you have not read line by line. What it does, from its [security](/docs/security) and [Git deploy](/docs/git-deploy) documentation:

- **Sandboxed builds.** Install and build commands run as the hosting account through systemd, inside the account's CPU and memory limits, unable to write outside its home.
- **Per-account sandbox.** Each hosting account is a separate Linux user in its own systemd slice with CPU, memory and process limits; customers cannot read each other's `domains` folders, and SFTP is chrooted. One runaway app cannot take the others down.
- **Signed webhooks.** Push deploys verify GitHub's `X-Hub-Signature-256` or the GitLab/Gitea token header; the secret is never accepted in the URL, and only the configured branch deploys.
- **A panel without root.** The web panel runs as an unprivileged user and asks a separate root agent for a fixed list of actions, each parameter checked again.
- **Health checks and rollback.** A new release must answer its health check before nginx switches to it, otherwise the previous one keeps serving and the owner is notified; **Rollback** keeps the last 5 builds without downtime.
- **WAF.** ModSecurity with the OWASP Core Rule Set, per website, with **Detect only** mode to tune it first ([ModSecurity and OWASP CRS](/blog/modsecurity-owasp-crs-hosting)).
- **Operations.** Firewall and Fail2ban out of the box, free SSL, database and file backups, an uptime check about every 3 minutes, and app environment variables encrypted at rest in the panel database.

What it does not do: it does not review your code, write your authorization checks or RLS policies, scan your dependencies for vulnerabilities, or give you preview deployments to test a change before it goes live. Use a staging website for that. Deployment steps are in [Git deploy](/docs/git-deploy), and the [Free plan](/pricing) covers 10 websites on one server with no time limit.

## Conclusion

Vibe coding is fast because nobody reads every line, so the review has to be targeted. Do sections 1 to 4 in the code, because no platform can do them for you, then deploy on a server that contains a mistake instead of amplifying it, with a rollback one click away. If you are moving an app off its builder at the same time, our guides on [deploying a vibe-coded app](/blog/deploy-vibe-coded-app) and [Bolt.new, v0 and Replit apps](/blog/deploy-bolt-v0-replit-app) cover the rest.

## FAQ

### Is AI-generated code less secure than human code?

We do not cite a single number, because the published studies measure different things. What is clear is the pattern: code tested only by its author on the happy path tends to miss authorization checks, which is why broken access control leads the OWASP Top 10:2025. Review that first.

### Is the Supabase anon key safe in the browser?

Yes, if Row Level Security is on. Supabase's [API keys guide](https://supabase.com/docs/guides/api/api-keys) calls the publishable key (the successor of the anon key) safe to expose, because "it only reaches what Row Level Security allows", and says to enable RLS on every table before you deploy. The secret or service role key bypasses RLS and must stay on the server.

### Can a web application firewall replace a code review?

No. A WAF such as ModSecurity with the OWASP Core Rule Set blocks many known attack patterns, such as SQL injection and XSS payloads, but it cannot know that a valid request for another user's record should be refused. Use it as a second layer.

### What should I do if I pushed an API key to GitHub?

Revoke it at the provider immediately and create a new one, then remove it from the code and use an environment variable. Removing the commit is not enough, because the key stays in Git history and in any clone or fork.

### How do I roll back a broken AI-generated change?

Keep releases separate so the previous one is still on disk, and switch back to it before you debug. On ZoPanel, open the website's **Deploy** tab and click **Rollback** on one of the last 5 releases; server apps switch after a health check, without downtime.
