SAMPLE REPORTThe app, the company, the people, the dates and every finding below are invented to show the format. This is not a report about any real app or client.
Security audit report · Audit + Fix

Sample Booking App

A clinic appointment booking app, built with an AI app builder on Supabase. Web front end at app.example.com.

Prepared forExample Clinic Ltd. (invented)
Prepared byLattice Nepal
Permission and proof of ownershipPermission letter signed on day 1. DNS TXT record on example.com confirmed the same day.
Testing windowDays 2 to 4, staging project only
ReportDay 5 (version 1). Re-test on day 9 (version 2, this document).

1. Summary

We found 7 weaknesses: 3 critical, 2 high, 1 medium and 1 low. The three critical ones each let a signed-in patient, or anyone on the internet, read or change other patients' data.

All fixes were delivered as pull requests and merged by the client. On re-test, 6 findings are fixed and 1 is partly fixed (F-06, see below).

IDFindingSeverityAfter re-test
F-01Any signed-in user can read every bookingCriticalFixed
F-02Service-role key shipped in the browser bundleCriticalFixed
F-03Users can make themselves adminCriticalFixed
F-04Edge function sends anyone's invoice without sign-inHighFixed
F-05Patient documents in a public storage bucketHighFixed
F-06No limit or CAPTCHA on sign-in codesMediumPartly fixed
F-07Source maps published on the live siteLowFixed

2. Scope and method

  • In scope: the staging Supabase project (11 tables, 2 storage buckets, 4 edge functions), the web front end build, and the GitHub repository.
  • Out of scope: the production project and its data, the clinic's email and domain accounts, third-party services, and anything not listed above.
  • Accounts used: two patient test accounts and one staff test account that we created (Patient A, Patient B, Staff S). No real patient account was opened.
  • Method: every RLS policy read against the intended access table agreed with the client; each table, bucket and function called directly as Patient A, Patient B, Staff S and with no sign-in; the front end bundle and git history searched for keys; sign-up, sign-in and reset flows walked through by hand.
  • Not done: no load or denial-of-service testing, no social engineering, no automated vulnerability scanning of hosts we were not given.

Severity scale

CriticalOther users' data can be read or changed, or the whole back end taken over, with little effort.
HighSensitive data or actions are exposed, but something extra is needed (a guessable name, a specific ID).
MediumAbuse that costs money or weakens accounts without direct data access.
LowMakes other attacks easier. Fix when convenient.

3. Findings

F-01 · Any signed-in user can read every booking

Critical

What we found

RLS is enabled on public.bookings, so the dashboard shows the table as protected. Its only SELECT policy is using (true), which lets every caller through.

Evidence

-- pg_policies
tablename | policyname                         | cmd    | qual
bookings  | Enable read access for all users   | SELECT | true

# Signed in as Patient B (test account)
GET /rest/v1/bookings?select=id,patient_id,reason,starts_at
→ 200, 14 rows. 9 rows have patient_id = Patient A and Staff S test data.
  Patient B owns 5.

Fix (pull request #1)

drop policy "Enable read access for all users" on public.bookings;

create policy "Patients read their own bookings"
  on public.bookings for select to authenticated
  using ((select auth.uid()) = patient_id);

create policy "Staff read bookings for their clinic"
  on public.bookings for select to authenticated
  using (clinic_id in (select clinic_id from private.staff
                       where user_id = (select auth.uid())));

Re-test

Fixed. The same request as Patient B returns 5 rows, all with Patient B's ID. With no sign-in it returns 0 rows. A database test for both cases was added to the repository (supabase/tests/bookings_rls.test.sql) and passes.

F-02 · Service-role key shipped in the browser bundle

Critical

What we found

The admin screen creates a second Supabase client with the service-role key, read from VITE_SUPABASE_SERVICE_KEY. Every VITE_ variable is compiled into the public JavaScript. The service-role key skips all RLS policies.

Evidence

assets/index-4f2a91.js contains a second token beginning eyJhbGciOi…
Decoded payload: { "role": "service_role", … }

# With that key, no sign-in
GET /rest/v1/patients?select=count
→ 200, full row count returned (test data only on staging)

We stopped at the row count. We did not download the table.

Fix (pull request #2, plus a key change done with the client on a call)

The two admin actions moved into an edge function that checks the caller is staff. The variable was removed from the front end and from the hosting settings. The client created new API keys in the Supabase dashboard and revoked the old ones while we watched; we did not keep either key.

Re-test

Fixed. The new bundle contains only the publishable key. The old service-role key now returns 401. The git history still contains the old key, which no longer matters because it is revoked.

F-03 · Users can make themselves admin

Critical

What we found

The policy on public.profiles correctly limits updates to a user's own row. It does not limit which columns, and the row includes role. The front end hides the admin menu for patients, but the database accepts the change. Automated scanners pass this table because the policy has an owner check.

Evidence

# Signed in as Patient B
PATCH /rest/v1/profiles?id=eq.<Patient B id>
{ "role": "admin" }
→ 204

# Reload the app as Patient B: the admin menu appears and
# /admin/patients lists all test patients.

Fix (pull request #3)

-- Users may update only these columns of their own row
revoke update on public.profiles from authenticated;
grant update (full_name, phone, avatar_url) on public.profiles to authenticated;

-- Roles move out of the editable table
create table private.staff (
  user_id uuid primary key references auth.users on delete cascade,
  clinic_id uuid not null,
  role text not null check (role in ('staff', 'admin'))
);

Re-test

Fixed. The same request now returns 403 (permission denied for column role). Patient B's role was reset. Changing full_name still works.

F-04 · Edge function sends anyone's invoice without sign-in

High

What we found

The send-invoice function is deployed with verify_jwt = false and does not check the caller in its code. It takes a booking_id and an email, and emails that booking's invoice to that address.

Evidence

# No Authorization header
POST /functions/v1/send-invoice
{ "booking_id": "<Patient A booking>", "email": "<our test inbox>" }
→ 200. Patient A's invoice PDF arrived in our test inbox.

Fix (pull request #4)

verify_jwt set back to true. The function now builds a Supabase client from the caller's token, loads the booking through RLS, and sends only to the email address on the caller's own account. The email field was removed from the request.

Re-test

Fixed. No token: 401. Patient B's token with Patient A's booking: 404. Patient A's token with Patient A's booking: invoice sent to Patient A's address.

F-05 · Patient documents in a public storage bucket

High

What we found

The documents bucket is public and files are named after the booking ID. Anyone who knows or sees a booking ID can open the file without signing in. Booking IDs appear in page addresses and in emails.

Evidence

select id, public from storage.buckets;
documents | true

# No sign-in, in a private browser window
GET /storage/v1/object/public/documents/<Patient A booking id>.pdf
→ 200, the test referral letter

Fix (pull request #5)

Bucket set to private. Files moved to <patient id>/<random name>.pdf. Storage policies allow a patient to read only their own folder and staff only their clinic's patients. The app now shows files through signed links that expire after 10 minutes.

Re-test

Fixed. The old public address returns 400. Patient B asking for a signed link to Patient A's file is refused.

F-06 · No limit or CAPTCHA on sign-in codes

Medium

What we found

The sign-in form requests an SMS code with no CAPTCHA. The project's rate limits were raised during development and never lowered.

Evidence

From one address, 30 code requests for our own test phone number in 5 minutes were all accepted and delivered. We stopped there.

Fix

CAPTCHA protection enabled in the Supabase dashboard and wired into the sign-in and sign-up forms (pull request #6). We recommended lowering the SMS limit and allowing only the country the clinic serves.

Re-test

Partly fixed. Requests without a CAPTCHA token are refused. The SMS limit is unchanged because the client is waiting for their SMS provider to confirm expected volume. This is the client's decision and is recorded here as open.

F-07 · Source maps published on the live site

Low

What we found

build.sourcemap is true in vite.config.ts, so the original source with comments is downloadable. It made F-02 and F-04 quicker to find.

Evidence

GET /assets/index-4f2a91.js.map → 200.

Fix (pull request #7)

build: { sourcemap: false }.

Re-test

Fixed. The .map address returns 404 after the next deploy.

4. Checked and found in order

  • RLS is enabled on all 11 tables. Policies on 8 tables matched the agreed access table with no change needed.
  • Email confirmation is required before sign-in.
  • The payment webhook verifies the provider's signature and ignores repeated events.
  • No .env or .git files are served by the live site.
  • Edge function logs do not contain tokens or full patient records.

5. What we recommend next

  1. Decide the SMS limit and close F-06.
  2. Run the database tests in your deploy pipeline, so a later change that loosens a policy fails before it goes live.
  3. Turn on two-step sign-in for the two owner accounts on Supabase and GitHub that do not have it.
  4. Take a backup outside the platform and restore it into a spare project once.

6. Limits of this report

This report describes what we tested, in the scope and time listed above, on the version of the app deployed in the testing window. It is not a promise that no other weakness exists, and later changes to the app can open new ones. Test accounts and test data we created were deleted on day 9. Our copy of the evidence is deleted 30 days after the final report unless the client asks for it sooner.

END OF SAMPLEInvented app and findings. A real report follows this format for your app.