Citadel Cyber
Sample report · DemoShop (fictional)

External Security Audit — DemoShop (sample app)

Prepared by: Citadel Cyber LLC · citadelcyber.dev
Engagement type: Passive external review of a vibe-coded application
Target: DemoShop (sample app) — a fictional storefront built on a typical Lovable/Bolt/Cursor + Supabase stack

Executive summary

DemoShop is a small e-commerce app with a hosted frontend and a Supabase backend. We performed a non-intrusive, external review: we looked at what the application exposes to any ordinary visitor — the shipped JavaScript bundle, the public API surface, the HTTP response headers, and the public DNS records. We did not exploit anything, modify any data, or attempt to access accounts we were not given. Every finding below was observed from outside, using only information the app already hands to the public.

Overall rating: At Risk. The app ships a server-grade Supabase credential in the browser and exposes at least one database table that the public anonymous key can read directly. Either issue alone would justify urgent attention; together they mean customer-facing data should be treated as already exposed until the keys are rotated and access control is turned on. The remaining findings are real but lower-urgency hardening items.

The good news: the stack is a common one, and all five findings have well-understood, low-effort fixes. None require re-architecting the app.

Scope

In scope (observed passively):

Out of scope:

Method

Passive and external only. We read what the application serves to every visitor and made read-only requests to the public Supabase REST endpoint with the same anon key the app ships. We made no write operations, no exploitation, no attempts to read other users' records beyond confirming that a request would succeed.

Strengths observed

Findings

1. Service-role Supabase key shipped in the frontend bundle — Critical

What we saw. The production JavaScript bundle contains a Supabase service_role JWT. This key is visible to anyone who opens the browser developer tools and reads the loaded script.

Why it matters. The service-role key bypasses row-level security entirely. Anyone who copies it from the bundle can read, modify, or delete every row in every table, regardless of any policy. It is equivalent to publishing your database admin password.

How to fix.

How to verify the fix. Rebuild and redeploy, then search the live bundle for the key prefix (service_role JWTs decode to "role":"service_role"). Confirm the only Supabase key present decodes to "role":"anon". Confirm the old key no longer works by checking that requests signed with it are rejected after rotation.

2. Public table readable by the anonymous key with no RLS — High

What we saw. A read-only request with the public anon key returned rows from a customer orders table through the Supabase REST endpoint, which means row-level security is off or ineffective on that table. To find every table without RLS, the owner can run this in the Supabase SQL editor:

select tablename from pg_tables where schemaname = 'public' and not rowsecurity;

Why it matters. With RLS off, Supabase's row filtering does not apply, so the public anon key — which is embedded in every copy of the app — can read the entire table. This exposes customer records to anyone, not just logged-in owners.

How to fix. Enable RLS on every table in public, then add explicit per-operation policies scoped to the owning user:

alter table public.orders enable row level security;

create policy "orders_select_own"
  on public.orders for select
  using ( (select auth.uid()) = user_id );

create policy "orders_insert_own"
  on public.orders for insert
  with check ( (select auth.uid()) = user_id );

create policy "orders_update_own"
  on public.orders for update
  using ( (select auth.uid()) = user_id )
  with check ( (select auth.uid()) = user_id );

create policy "orders_delete_own"
  on public.orders for delete
  using ( (select auth.uid()) = user_id );

How to verify the fix. Re-run the detection query — it should return no rows. The SQL editor runs as postgres and bypasses RLS, so test from the app or with simulated roles: signed in as user A, confirm a query for the table returns only user A's rows and never user B's.

3. UPDATE policy with WITH CHECK looser than USING — Medium

What we saw. An update policy restricts which rows a user may update via its USING clause, but its WITH CHECK clause is with check (true) — looser than the USING condition.

Why it matters. On an UPDATE, USING decides which existing rows are visible to change, while WITH CHECK validates the row after the change. With with check (true), a user who can update their own row can rewrite its user_id to another value — reassigning the record to someone else or to themselves, defeating ownership. The two clauses must agree.

How to fix. Make WITH CHECK match USING so a row cannot be edited out from under its owner:

drop policy if exists "orders_update_own" on public.orders;

create policy "orders_update_own"
  on public.orders for update
  using ( (select auth.uid()) = user_id )
  with check ( (select auth.uid()) = user_id );

How to verify the fix. Signed in as user A, attempt to update one of your rows and set user_id to user B's id — the write should be rejected. Normal updates that keep your own user_id should still succeed.

4. Content-Security-Policy allows unsafe-inline — Low

What we saw. The CSP header includes 'unsafe-inline' in its script-src (and/or style-src) directive.

Why it matters. 'unsafe-inline' permits inline <script> and event-handler attributes to execute. That re-opens the main door CSP is meant to close: if an attacker can get markup onto a page, the browser will run it. The policy is present but not providing its core protection.

How to fix. Remove 'unsafe-inline' and move inline scripts into bundled files. Where inline execution is unavoidable, use a per-response nonce (script-src 'nonce-...') or hashes rather than a blanket allowance. Tighten style-src the same way where practical.

How to verify the fix. Inspect the live Content-Security-Policy response header and confirm 'unsafe-inline' is gone. Load the app with the browser console open and confirm no CSP violations break functionality.

5. DMARC policy is p=none — Low

What we saw. The domain publishes a DMARC record with p=none.

Why it matters. p=none is monitor-only: it asks receivers to report on messages that fail SPF/DKIM alignment but takes no action on them. It does not stop anyone from spoofing your domain in phishing emails to your customers.

How to fix. After confirming your legitimate mail sources pass SPF and DKIM alignment (review the DMARC aggregate reports first), move the policy to p=quarantine and then to p=reject:

v=DMARC1; p=quarantine; rua=mailto:[email protected]; fo=1

Advance to p=reject once reports confirm no legitimate mail is being caught.

How to verify the fix. Query the DNS TXT record at _dmarc.<your-domain> and confirm the policy reads p=quarantine or p=reject. Confirm legitimate mail still lands normally.

Summary table

Summary of findings
#FindingSeverityCore fix
1Service-role key in frontend bundleCriticalRotate key; keep only the anon key in the browser
2Public table readable by anon key, no RLSHighEnable RLS; add per-operation owner policies
3UPDATE WITH CHECK looser than USINGMediumMake WITH CHECK match USING
4CSP allows unsafe-inlineLowDrop 'unsafe-inline'; use nonces/hashes
5DMARC p=noneLowAdvance to p=quarantine, then p=reject
  1. Today: Rotate the service-role key and purge it from the client (Finding 1).
  2. This week: Enable RLS on every public table and add owner-scoped per-operation policies; re-run the detection query until it returns no rows (Findings 2 and 3).
  3. This month: Tighten the CSP and advance DMARC toward enforcement (Findings 4 and 5).
  4. Ongoing: Re-run the RLS detection query as part of each release, and keep server-grade secrets out of anything that ships to the browser.

A short re-check after the Critical and High items are fixed is the best way to confirm the exposure is closed.

Want this for your app? The Launch Audit is a security audit for vibe-coded apps: every finding ranked worst first, what an attacker could do with it, a fix prompt for each, and one re-test. $119 founding, normally $249.

About the audit Join the waitlist Compare plans