Get the free coreGet core

Vibe coding security checklist: 20 checks before you ship

Updated 8 min readSection 03 / Is it safe?
SHORT ANSWER

This vibe coding security checklist has twenty checks in six groups: secrets, keys, database access, packages, the agent on your Mac, and code with backups. Each is a command, a setting or a concrete check. Start with the first one: never put secret API keys in source code, because bad actors scan public repos. If a key leaked, treat it as compromised.

01How to secure vibe coded apps: use the list in order

The checks start with leaked keys and end with an agent that deletes things. Tick them off as you go. This vibe coding security checklist assumes you build with an agent such as Claude Code, Cursor or Codex on a Mac.

GroupChecksWhat it protects
Secrets1 to 6Keys and tokens in your repo
Keys7 to 9Keys that already exist or may leak
Database access10 and 11User data behind your app
Packages12 to 14What gets installed on your Mac
The agent on your Mac15 to 18Files and credentials the agent can reach
Code and backups19 and 20Your ability to review and undo

This vibe coding security checklist is the short form; the reasoning behind each group is in vibe coding security.

02When to run the vibe coding security checklist

Run it in full before the first deploy. Run the matching group again whenever something changes. A new payment provider means the secrets and keys groups, because a leaked secret key can allow unauthorized charges and data access. A new database table means the database group. A new package or MCP server, a helper program that gives the agent extra tools, means the packages group. A new agent tool or a looser permission mode means the agent group.

03Secrets: keep them out of the repo

A repo is the folder Git tracks for your project, and its history is every earlier version of it. Anything committed there can be copied, and public repos are scanned by bad actors.

  1. Keep secret API keys out of source code. Open the files the agent wrote and look for any key value pasted into the code. API keys are account credentials, like a username and password.
  2. Put keys in a .env file and do not commit it. Add the dotenv library, which loads variables from .env into process.env. Its FAQ says do not commit the file at all, unless you encrypt it first with dotenvx, a separate tool that encrypts the file. Simplest is never to commit it.
  3. Add these lines to .gitignore: .env, .env.* and !.env.example. That is how GitHub's Node template ignores .env files but keeps .env.example.
  4. Turn on GitHub push protection for the repository. It blocks pushes that contain secrets before they reach the repository.
  5. Scan your repo and its history with TruffleHog. Install it with brew install trufflehog, then scan your local repo from its folder with trufflehog git file://., as in the README example. A result marked verified means the credential was confirmed valid and active.
  6. Add a commit-time guard. Install git-secrets with brew install git-secrets, then run git secrets --install inside every repo, because the hooks, scripts git runs automatically, are not installed for you. It scans commits and commit messages to prevent adding secrets.

04Keys: limit, replace, rotate

  1. Restrict every key that runs in a browser. Google Cloud says unrestricted API keys are insecure, and Google staff say they are moving to disable unrestricted keys in the Gemini API. Open each key in the provider's console, on the page where it is listed (for Google, the API keys page), and apply its restrictions so it works only for the services and sites your app uses. A key shown as unrestricted is the one to fix first.
  2. Replace a leaked key at once, then read the logs. GitHub's guidance is to consider any leaked secret immediately compromised. Look in the provider's logs or audit trail for any use of the secret.
  3. Rotate secrets on a schedule. Rotate secrets regularly to minimize the impact of a leak. Put a repeating reminder in your calendar for each provider. At each reminder, create a new key with the same restrictions, put it in your .env, then delete the old key once the app runs on the new one.

05Database access

Row-level security means rules for which rows each user may read or change.

  1. Test your app as a logged-out visitor, then as a second user. Open it in a private window without signing in, then sign in with a second test account and try to load the first account's data. Lovable's docs say misconfigured row-level security rules are a common cause of data leaks.
  2. Confirm every table that holds user data has a row-level security rule. In your database's dashboard, open each table that stores user data and look for a switch or policy list for row-level security; a table with none is open. Then repeat the test from check 10. A CVE, a public ID number for a known flaw, was recorded for weak row-level security in Lovable that let attackers without a login read or write tables of generated sites.

06Packages

An npm package is a library installed from JavaScript's package registry. An MCP server is often installed the same way, so both are in this group.

  1. Read every package name the agent adds before you install. Open package.json after each agent run. A model can invent a name that does not exist, and slopsquatting means an attacker registers it. Vibe coders may never type or search for a package name by hand.
  2. Check if you ever installed postmark-mcp. It is an MCP server, a helper program that gives the agent extra tools, and a version was reportedly changed to copy email contents to an outside address. If you installed or used it since mid-September 2025, uninstall it, change every credential that went through it, and review your email logs. If you never used it, you are done.
  3. Check that each MCP server comes from someone you trust. Open your agent's list of MCP servers and remove any you did not add on purpose. Claude Code's docs say to verify you trust each server before connecting it.

07The agent on your Mac

By default an agent can see more than you expect. In Claude Code's auto mode, reading .env and sending credentials to a matching API is allowed by default, and sandbox environment variables are inherited, secrets included.

Items 15 to 18 give the Claude Code step first and the Cursor step second. If you use only one of the two, skip the other.

  1. Deny the agent access to secret files. Claude Code: add a deny rule Read(./.env), which matches reading the .env file in the current directory. Deny rules go in the permissions section of .claude/settings.json, and a deny rule blocks in every permission mode. Cursor: its agent can read files outside your project by default. In Cursor 3.23 or later you can change that read access setting to Workspace.
  2. Block edits to protected files with a hook. A hook is a script the agent runs automatically at set points. Claude Code: save Anthropic's example protect-files.sh, which blocks .env, package-lock.json and .git/, as .claude/hooks/protect-files.sh in your project and make it executable: `` chmod +x .claude/hooks/protect-files.sh ` Then add this to .claude/settings.json [S4-3]. PreToolUse means "before the agent uses a tool", and the matcher picks which tools: ` { "hooks": { "PreToolUse": [ { "matcher": "Edit|Write", "hooks": [ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-files.sh" } ] } ] } } ` Test it by asking Claude to add a comment to .env; the edit should be blocked [S4-4]. The full script and more examples are in [Claude Code hooks](/claude-code/hooks/). Cursor has its own hooks, such as beforeShellExecution, which controls shell commands [S1-147]. A Cursor hook that exits with code 2 blocks the action [S1-148], and failClosed: true` makes a crashed hook block too. This item is the one to skip if you are new to hooks.
  3. Run the agent where a mistake cannot reach your secrets. Claude Code: use a container, an isolated environment on your Mac, and mount no secrets into it. Do not mount host secrets such as ~/.ssh into it. Setup is in the devcontainer guide and the Docker guide. Cursor: keep its sandbox on, which on a Mac uses Seatbelt, the built-in macOS sandbox, with no extra setup. In the default Auto-review mode, Cursor sandboxes shell commands when it can. See Cursor sandbox.
  4. Do not turn off the approval prompts outside an isolated environment. Claude Code: the flag --dangerously-skip-permissions is the same as bypassPermissions mode, and the docs limit that mode to containers, VMs or dev containers without internet access. One npm attack prompted installed AI tools with it; the story is in the flag article. Cursor: the matching mode is Run Everything, where every tool call runs automatically. Pick Auto-review instead, which Cursor recommends, in Settings > Agents > Approvals & Execution.

08Code and backups

  1. Review and test generated code before it ships. Be careful with security-sensitive code and always review and test it thoroughly.
  2. Commit before every agent session so you can go back. Files changed only by Bash commands are not tracked by Claude Code's checkpoints, so use Git.

09If you only have time for three checks

If the vibe coding security checklist feels long, do number 1, keep secret keys out of code. Do number 8, replace any key that leaked. Do number 10, test who can read your database. For flaws in the generated code itself, see the studies in AI-generated code vulnerabilities. For the agent's own reach, see AI agent security and Claude Code security. A fuller Claude Code setup is in how to run Claude Code safely.

Tool verdicts: Is Claude Code safe?, Is Cursor safe?, Is Codex safe?, Is Copilot safe?, Is Claude safe?.

The checklist covers what you ship; it doesn't show what already ran on the machine you build on. For the last item on any checklist, knowing what ran, Artificial Immunity's free, open-source core watches agent sessions and program starts on your Mac and reports what it finds.

FAQ

How secure is vibe coding?

That depends on the checks you run. Apps tend to break in four places: leaked secrets, open database access, risky packages and an agent with too much reach on your machine. Each has numbered checks below.

How to make sure your vibe coded app is secure?

Work through the list in order. If you only have time for three checks, do number 1, keep secret keys out of source code, number 8, replace any key that leaked, and number 10, test database access.

What are the security vulnerabilities associated with vibe coding?

Leaked keys, missing row-level security, hallucinated or malicious packages and flaws in generated code, which the studies page covers.

Are vibe-coded apps safe?

Not automatically. GitHub's docs say to review and test generated code thoroughly when it is security-sensitive.

What do I do if a key already leaked?

Treat it as compromised, because deleting it from the code does not prevent exploitation. Replace it, then check logs for use of the secret.

Sources

  1. Stripe: API key best practices
  2. dotenv README
  3. GitHub gitignore: Node template
  4. GitHub docs: push protection
  5. TruffleHog README
  6. git-secrets README
  7. Google Cloud: API keys
  8. GitHub docs: remediating a leaked secret
  9. Lovable docs: security
  10. Cursor docs: run modes
  11. Claude Code docs: hooks guide and permissions
  12. GitHub docs: Copilot code completion
  13. Artificial Immunity
Vibe coding with agents on your Mac? Artificial Immunity watches the Mac where your agents work.Get the free core