User A, User B: How to Test a Vibe-Coded App for Broken Access Control Before It Holds Real Data
Researchers found tens of thousands of Lovable and Grok Build apps open to anyone. Here's the two-account test that catches broken access control.
- Published
- Reading time
- 18 minutes
- Written by
-
Jon McLachlan - Draws on
- Episode 89 of the podcast
Researchers found tens of thousands of Lovable and Grok Build apps open to anyone. Here's the two-account test that catches broken access control.
Two studies published in November 2026 measured the same failure across tens of thousands of AI-built applications.
On November 2, Handelsblatt reported research by the German security firm Crissy Field, which analyzed 159,041 Lovable projects found in Common Crawl. Of the 34,545 that used a Supabase database, 24,664 returned database records to an unauthenticated visitor on page load, and 7,403 exposed email addresses. The records included more than 1,000 passport entries at one company, more than 200,000 private chat messages on a German forum, event tickets and orders with payment details, contracts and invoices (Cybernews, The CyberSec Guru).
On November 10, Claroc Research published a scan of apps built and hosted with Grok Build under the grok.me domain. Of 37,571 reachable apps, 35,578 opened without a sign-in. Exposed content included an ICU patient briefing, a hospital roster of more than 3,500 staff, a timesheet containing 18 plaintext passwords, and confidential material from apps built by the platform’s own employees (Claroc, PYMNTS).
Neither case involved a vulnerability in the platform’s software. In both, the applications authenticated users, or didn’t need to, and never enforced which records each user could read. That class of defect is called broken access control. This guide covers how it arises in AI-generated applications, how Supabase’s row-level security is meant to prevent it, a manual test that finds most instances in about five minutes, the SQL to audit a Supabase project, and how to keep the result from regressing.
The short answer
An application built by an AI tool will usually implement authentication, the login flow, because it’s visible and requested. It often won’t implement authorization, the per-record rule that decides which rows a user can read or modify. On stacks where the browser queries the database directly, such as React with Supabase, that rule has to live in the database as row-level security (RLS). When it’s missing, any visitor holding the public API key, which every visitor has, can read the tables.
To check an application:
- Create two accounts, User A and User B.
- As User A, create a private record and note its URL or ID.
- As User B, request that record through the interface and directly through the API, with and without a user filter.
- Repeat each request with no session token.
- In Supabase, query
pg_tablesandpg_policiesfor tables without RLS and policies that grant theanonrole unconditional access.
If any request returns User A’s data, the application doesn’t enforce ownership. Fix it in the database or server, not the frontend, and add automated tests so it stays fixed.
What happened in the Lovable and Grok Build exposures?
The two incidents failed at different layers, which is useful because together they cover most AI app builders.
| Lovable (Crissy Field / Handelsblatt) | Grok Build (Claroc Research) | |
|---|---|---|
| Published | November 2, 2026 | November 10, 2026 |
| Sample | 159,041 projects from Common Crawl | 37,571 reachable apps under grok.me |
| Exposed | 24,664 Supabase-backed apps returned records without login; 7,403 exposed emails | 35,578 apps opened without sign-in |
| Layer that failed | Database authorization: RLS missing or misconfigured | Application sharing: “Anyone with the link” preselected |
| How apps were found | Public web crawl | Passive DNS records for *.grok.me |
| Examples of data | Passports, private messages, orders with payment details, contracts | ICU patient briefing, staff rosters, plaintext passwords, confidential sales material |
Lovable. Lovable generates React frontends that talk to Supabase through its auto-generated REST API (PostgREST). The researchers used the public key embedded in each app’s JavaScript, the same key any visitor’s browser receives, and made read-only requests. Where tables had no RLS policies, or policies that allowed the anonymous role to read every row, the API returned the data. Cybernews reports that Lovable described it as a “known, industry-wide configuration problem” (Cybernews).
Grok Build. Grok Build publishes each app to its own hostname. The publish dialog offers “Anyone with the link,” “Invited users” or “Only you,” and Claroc found the first preselected in the paid account it used. Hostnames are recorded by passive DNS services, so an unshared link was still discoverable. Claroc also reported that in team apps using “Continue with Google,” the generated code added the signing-in user to the team before checking membership, so the check always passed (Claroc). The company told a reporter that apps are private until shared and that employee accounts default to “Only you”; Claroc disputes that this protects users.
Earlier precedent. In February 2026, Wiz found the same Supabase pattern at Moltbook, a social network for AI agents: a key in client-side JavaScript, no RLS, and full read and write access to about 4.75 million records, including 1.5 million API tokens and 35,000 email addresses. Moltbook closed it within hours of the report. Wiz noted that its first fix blocked reads while writes through PATCH still worked, which is why tests need to cover both (Wiz).
What is broken access control?
Broken access control is a failure to enforce what a user, or an anonymous visitor, may read or change. It has been ranked A01 on the OWASP Top 10 since 2021 and kept that position in the 2025 edition, which also folded server-side request forgery into the category. The Register’s summary of the 2025 data puts it at 3.73 percent of applications tested (The Register).
The terms that come up in testing:
- Authentication establishes who the user is. Authorization decides what that user may do with a specific resource. Login screens are authentication; access control is authorization.
- Insecure direct object reference (IDOR) is the classic form: a request includes an identifier, such as
/orders/1842, and the server returns the object without checking that it belongs to the requester. - Broken Object Level Authorization (BOLA) is the same defect in an API, ranked API1 on the OWASP API Security Top 10 for 2023. In Supabase, every table exposed through PostgREST is effectively an API endpoint, so BOLA is the relevant model.
- Missing function-level authorization is the related case where an endpoint or action, such as an admin export, is reachable by users who shouldn’t have it.
Most of these defects are old and well understood. Jack Cable, who worked on Secure by Design at CISA before founding Corridor, made the point on episode 84:
“many of the vulnerabilities that we see out there exploited aren’t all that complicated. They are preventable.”
Jack Cable, Corridor, on episode 84
Why do AI-built apps ship without authorization?
Three properties of AI-assisted development make authorization the layer most likely to be missing.
It isn’t visible in a demo. A prompt such as “an app where users log in and save their orders” produces a working login and an orders page. Clicking through as one user shows only that user’s orders, because the frontend filters by the current user’s ID. The missing server-side rule is invisible until a second user, or a modified request, asks for someone else’s rows.
It lives in several places. Authorization checks can sit in the frontend, the API handlers and the database. Graham Neray, co-founder and CEO of Oso, described this fragmentation on episode 89:
“What makes it especially hard is that you check permissions at various levels in the stacks.”
Graham Neray, Oso, on episode 89
A code generator that writes a correct frontend filter has satisfied the visible requirement. Whether the database enforces the same rule depends on whether anyone asked. We cover why authorization is still built by hand at most companies, and the RBAC, ReBAC and ABAC models behind it, in Authorization Is the Last Layer Companies Still Build From Scratch.
Coding agents trust their environment. Agents generate migrations and schema changes quickly, and a table created through raw SQL or a migration doesn’t get RLS unless the migration enables it. The broader pattern, agents trusting what they find and rarely verifying it, is the subject of Vibe Coding Security: How to Stop AI Agents From Shipping Vulnerable Code.
How does Supabase row-level security work?
A Supabase project exposes the tables in its API schemas, public by default, through PostgREST. A browser request carries two credentials:
- The project key (the legacy
anonkey or the newer publishable key) identifies the project. Requests made with it run as the Postgresanonrole. It’s public by design and appears in every client bundle. - The user’s session token, a JWT issued by Supabase Auth after login. With it, requests run as the
authenticatedrole, and the user’s ID is available in SQL asauth.uid().
Postgres then applies two independent checks:
- Grants decide whether a role may touch a table at all. Supabase’s documentation notes that on existing projects “a new table in
publicstarts with every privilege already granted” toanon,authenticatedandservice_role. - Row-level security policies decide which rows a role can see or change. Once RLS is enabled on a table, nothing is accessible through the API with the public key until a policy allows it.
With RLS disabled, grants are the only control, and Supabase’s documentation is direct about the result: “A table in an exposed schema without RLS is readable and writable by any role with a grant on it” (Supabase). That is the state of the tables in the Lovable research.
Two further details matter in audits:
- The
service_roleor secret key bypasses RLS entirely. It belongs on a server or in an edge function, never in frontend code or a mobile app. - Blocked queries don’t raise errors. RLS filters rows, so a disallowed
selectreturns an empty array and a disallowedupdatechanges zero rows. Tests must assert on empty results, not on failures.
How do you test for broken access control in five minutes?
Use a staging environment if one exists, or production with records you create yourself. Only test applications you own or are authorized to test.
Step 1: create two accounts. Register User A and User B with different email addresses, in separate browsers or a normal and a private window so the sessions don’t mix.
Step 2: create a private record as User A. An order, note, profile or uploaded file. Record its URL and any identifier in it, such as /orders/1842 or a UUID.
Step 3: request it through the interface as User B. Paste User A’s URL into User B’s session. Then change a numeric ID by one in each direction. A response containing another user’s data is an IDOR.
Step 4: request it through the API as User B. Open developer tools, select the Network tab and reload a page that shows User B’s own data. Find the request that returned it, right-click and choose Copy as cURL. On a Supabase application it will resemble:
curl "https://YOUR-PROJECT.supabase.co/rest/v1/orders?user_id=eq.USER_B_ID" \
-H "apikey: YOUR_PUBLIC_KEY" \
-H "Authorization: Bearer USER_B_ACCESS_TOKEN"
Replace User B’s ID with User A’s, then remove the filter:
curl "https://YOUR-PROJECT.supabase.co/rest/v1/orders?select=*" \
-H "apikey: YOUR_PUBLIC_KEY" \
-H "Authorization: Bearer USER_B_ACCESS_TOKEN"
If either request returns User A’s rows, the user_id filter was the only protection, and it was supplied by the client.
Step 5: repeat without a session, and test writes. Remove the Authorization header so the request runs as anon, which reproduces the Lovable researchers’ method. Then attempt a change to User A’s record as User B:
curl -X PATCH "https://YOUR-PROJECT.supabase.co/rest/v1/orders?id=eq.USER_A_ORDER_ID" \
-H "apikey: YOUR_PUBLIC_KEY" \
-H "Authorization: Bearer USER_B_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: return=representation" \
-d '{"status":"test"}'
An empty array means the policy blocked the update. A returned row means User B modified User A’s data. If the application stores files, request User A’s file URL from User B’s session and from a logged-out browser as well.
How do you audit row-level security in Supabase?
The following queries run in the Supabase SQL editor and take a few minutes on a typical project.
Tables with RLS disabled.
select schemaname, tablename
from pg_tables
where schemaname = 'public'
and rowsecurity = false;
Every row returned is reachable through the Data API, limited only by grants. Enable RLS with alter table public.orders enable row level security;. Expect parts of the application to stop returning data until policies are written; that is the intended default.
Policies that grant unconditional access.
select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
and (qual = 'true' or with_check = 'true');
A policy such as to anon using (true) enables RLS without restricting anything. Supabase’s documentation says such a policy “grants every unauthenticated visitor read access to every row.” Each result should correspond to data that is intentionally public, such as a product catalog.
Ownership policies. For a table with a user_id column referencing auth.users, a minimal set of policies is:
alter table public.orders enable row level security;
create policy "orders_select_own" on public.orders
for select to authenticated
using ( (select auth.uid()) = user_id );
create policy "orders_insert_own" on public.orders
for insert to authenticated
with check ( (select auth.uid()) = user_id );
create policy "orders_update_own" on public.orders
for update to authenticated
using ( (select auth.uid()) = user_id )
with check ( (select auth.uid()) = user_id );
create policy "orders_delete_own" on public.orders
for delete to authenticated
using ( (select auth.uid()) = user_id );
using filters which existing rows a statement can see; with check validates the rows it writes. An update policy without with check can let a user reassign a row to someone else. Wrapping auth.uid() in a subselect lets Postgres evaluate it once per statement instead of once per row.
Multi-tenant applications. Business applications usually scope data to an organization rather than a user. Store memberships in a table, and reference them from policies through a function kept outside the exposed schema:
create schema if not exists private;
create or replace function private.user_org_ids()
returns setof uuid
language sql stable security definer set search_path = ''
as $$
select org_id from public.memberships where user_id = (select auth.uid())
$$;
create policy "projects_select_org" on public.projects
for select to authenticated
using ( org_id in (select private.user_org_ids()) );
The function runs as its owner so the policy can read memberships without recursive policy checks, and keeping it in a non-exposed schema prevents it from being called through the API.
Other places RLS doesn’t reach.
- Views. A view runs with its owner’s privileges by default, which in Supabase is usually
postgres, so it returns every row of the underlying table. On Postgres 15 and later, create viewswith (security_invoker = true)or keep them out of exposed schemas. - Functions.
security definerfunctions in thepublicschema are callable through the API and bypass RLS. Move them to a private schema or add explicit checks. - Storage. Supabase Storage enforces access through policies on
storage.objects. Public buckets serve any file to anyone with its URL; private buckets with signed, expiring URLs are the safer default for user uploads. - Keys. Search the built frontend for the
service_roleor secret key. If it’s present, rotate it and move the dependent logic server-side.
Supabase’s Security Advisor, in the dashboard under Advisors, runs a linter over the project and flags tables with RLS disabled, security definer views and similar issues. Run it after every schema change.
For background on the Postgres feature itself, independent of Supabase, Microsoft’s POSETTE 2024 session Everything you need to know about Postgres Row Level Security covers it in about 18 minutes.
What about Grok Build, Firebase and other app builders?
When an app builder hosts the application and its data, the controls move from SQL to sharing settings and generated code.
- Sharing defaults. Check each published app’s visibility. Treat “Anyone with the link” as public: unique hostnames and long URLs leak through passive DNS, browser history, link previews, chat logs and search indexing.
- Real authentication for real data. Any app holding personal or business data should require sign-in, and then pass the User A, User B test.
- Team and invitation logic. Test membership checks with an account that isn’t in the team. Claroc’s finding, a membership check that ran after the user was added, is the kind of ordering defect generated code produces and a single outsider login reveals.
- Firebase. Review Firestore and Storage security rules.
allow read, write: if true;is fully public, andif request.auth != nullonly confirms that the requester is logged in to some account. Ownership rules compare the document’s owner field withrequest.auth.uid.
How do you keep access control from regressing?
A manual test confirms the state of the application on the day it runs. Coding agents change schemas and endpoints daily, so the test needs to run automatically.
Integration tests with two users. The following Vitest test uses supabase-js against a staging project with two seeded test users. It assumes orders.user_id defaults to auth.uid().
import { createClient } from "@supabase/supabase-js";
import { expect, test } from "vitest";
const url = process.env.SUPABASE_URL!;
const key = process.env.SUPABASE_PUBLISHABLE_KEY!;
async function signIn(email: string, password: string) {
const client = createClient(url, key, { auth: { persistSession: false } });
const { error } = await client.auth.signInWithPassword({ email, password });
if (error) throw error;
return client;
}
test("users cannot read or change each other's orders", async () => {
const a = await signIn(process.env.TEST_USER_A!, process.env.TEST_PASSWORD_A!);
const b = await signIn(process.env.TEST_USER_B!, process.env.TEST_PASSWORD_B!);
const anon = createClient(url, key, { auth: { persistSession: false } });
const { data: order, error } = await a.from("orders").insert({ item: "access-test" }).select().single();
expect(error).toBeNull();
// RLS filters rows, so a blocked query returns [] rather than an error.
const read = await b.from("orders").select("*").eq("id", order.id);
expect(read.data).toEqual([]);
const update = await b.from("orders").update({ item: "changed" }).eq("id", order.id).select();
expect(update.data).toEqual([]);
const anonymous = await anon.from("orders").select("*");
expect(anonymous.data).toEqual([]);
});
Write one test per table that holds user data, and run them in CI on every change to migrations or API code. For database-level tests, the Supabase CLI also supports pgTAP through supabase test db.
Rules for the coding agent. Add authorization requirements to the agent’s instructions file (CLAUDE.md, .cursorrules, Lovable’s knowledge file or equivalent), so new tables and features start with policies:
Every table that stores user or customer data must enable row-level security in the
same migration that creates it, with select, insert, update and delete policies scoped
to the owning user or organization. Never grant the anon role `using (true)` on
non-public data. Never reference the service_role or secret key in client code.
Views over protected tables must use security_invoker = true.
For each new table or endpoint that stores user data, add an integration test that
creates users A and B, creates a record as A, and asserts that B and an unauthenticated
client receive no rows on read and affect no rows on update or delete.
Agents follow these instructions reliably when they’re explicit, and the CI tests catch the cases where they don’t. For coding agents and secrets more generally, see The .env File Is Your First Security Program.
External testing. Automated tests cover the paths someone thought to write. An outside test covers the rest, including business-logic flaws that scanners miss. Rejah Rehim of Beagle Security made the timing argument on episode 82: applications are “released on a daily basis or on a weekly basis,” while testing often happens quarterly. What enterprise buyers now expect from a startup’s testing cadence is in Pentest Once a Year? What Enterprise Buyers Expect From AI Startups in 2027. Attackers are also running AI agents that find these gaps quickly, as described in ARTEX, the AI Hacking Tool Everyone Picked Up.
Access control checklist for vibe-coded apps
Before the application holds real data
- User B can’t read, list, update or delete User A’s records through the interface or the API.
- Requests without a session token return no private rows or files.
- Object identifiers can’t be incremented or guessed to reach other users’ records, and access is enforced regardless.
- Every table in an exposed schema has RLS enabled.
- No policy grants
anonorauthenticatedunconditional access to non-public data. - Update policies include
with checkclauses. - Views over protected tables use
security_invoker = true, andsecurity definerfunctions are outside exposed schemas. - The
service_roleor secret key doesn’t appear in frontend source or built assets. - Storage buckets for user files are private, with signed, expiring URLs.
- Hosted apps require sign-in; none are set to “Anyone with the link.”
After launch
- Two-user integration tests run in CI on every schema or API change.
- The coding agent’s instructions file specifies RLS and test requirements.
- Supabase’s Security Advisor is reviewed after schema changes.
- A named owner reruns this checklist after major changes and records the date.
How to answer the access-control question in a security review
Enterprise security questionnaires ask how tenant data is isolated. Answers such as “we use Supabase” or “users must log in” describe features, not enforcement, and reviewers increasingly ask for evidence. We describe that gap, and how it costs deals, in Enabled Isn’t Enforced: 5 Questionnaire Answers That Quietly Cost You the Deal. A strong answer is specific and dated:
Every table holding customer data enforces row-level security scoped to the requesting user's organization; privileged keys are used only server-side; integration tests on every release verify that one tenant can't read or modify another tenant's records; and an external penetration test last verified tenant isolation on [date].
Related questions buyers ask about AI features, with one-sentence answers, are collected in The 10 AI Security Questions Your First Enterprise Buyer Will Ask in 2027.
AI app builders have made it possible to put a production database in front of real users in an afternoon. The controls that protect that data are well documented and quick to verify. Running the two-account test, auditing RLS and adding the tests to CI before the first real user signs up is a small amount of work compared with explaining an exposure afterward.
Jon
Broken access control in vibe-coded apps, frequently asked questions
- What happened in the Lovable data exposure?
- In November 2026, the German security firm Crissy Field, working with the newspaper Handelsblatt, analyzed 159,041 Lovable projects found in Common Crawl. 34,545 used a Supabase database, and 24,664 of those returned database records to a visitor who was not logged in. 7,403 exposed email addresses. Exposed data included more than 1,000 passport records at one company, more than 200,000 private chat messages on a German forum, ticket and order records with payment details, contracts and invoices. Reporting attributes the exposure to missing or misconfigured row-level security (RLS) in Supabase, and Lovable described it as a known, industry-wide configuration problem.
- What happened with Grok Build apps?
- Claroc Research reported on November 10, 2026 that 35,578 of 37,571 reachable apps published with Grok Build under the grok.me domain opened without a sign-in. The publish setting 'Anyone with the link' was preselected in the account Claroc tested, and app hostnames were discoverable through passive DNS. Exposed apps included an ICU patient briefing, a hospital staff roster, a timesheet with plaintext passwords and confidential material from apps built by the platform's own staff.
- What is broken access control?
- Broken access control is any failure to enforce what an authenticated or anonymous user is allowed to read or change. It includes insecure direct object references (IDOR), where changing an ID in a URL or API request returns another user's record, missing function-level checks, and permissive defaults. It is ranked A01, the most serious risk, on the OWASP Top 10 for 2021 and 2025, and its API form, Broken Object Level Authorization (BOLA), is API1 on the OWASP API Security Top 10 for 2023.
- What is the User A, User B test?
- It is a manual test for insecure direct object references. Create two accounts. As User A, create a private record and note its URL or ID. As User B, request that URL, replay the API request with A's ID, and remove any user filter from the request. Then repeat each request with no session token. Any response that contains A's data means the server or database is not enforcing ownership.
- Is the Supabase anon or publishable key safe to put in frontend code?
- Yes, by design, provided row-level security is enabled on every table in an exposed schema and the policies restrict each row to the users who should see it. The key identifies the project and maps requests to the anon role; it does not grant data access by itself. Without RLS, Supabase's documentation states that a table in an exposed schema 'is readable and writable by any role with a grant on it.' The service_role or secret key bypasses RLS and must never be shipped to a browser.
- How do I check whether row-level security is enabled in Supabase?
- Run select tablename from pg_tables where schemaname = 'public' and rowsecurity = false; in the SQL editor. Every table returned is reachable through the Data API with only its grants to protect it. Then list policies that give the anon role unconditional access with select tablename, policyname from pg_policies where 'anon' = any(roles) and qual = 'true';. Supabase's Security Advisor in the dashboard also flags tables in public schemas with RLS disabled.
- Why does a query blocked by RLS return an empty array instead of an error?
- Row-level security filters rows rather than rejecting queries. A select that the policy blocks returns zero rows, and an update or delete affects zero rows. Automated tests should therefore assert that results are empty, not that the request failed, or they will pass while data is exposed.
- Can a Postgres view bypass row-level security?
- Yes. By default a view runs with the privileges of its owner, which in Supabase is usually the postgres role, so a view over an RLS-protected table can return every row. On Postgres 15 and later, create views with security_invoker = true so the caller's policies apply, or keep such views out of exposed schemas. Supabase's Security Advisor flags security definer views.
- What should I do if my app is exposing data?
- Enable RLS or switch sharing to sign-in required, then confirm the fix with the same two-account and no-session requests. Rotate any keys or credentials stored in readable tables. Review database and API logs for unexplained reads, and get legal advice on whether the exposure triggers notification duties under GDPR, US state breach laws or customer contracts.