Day 2 of 24

Check who can download your private files

A private record can have an attached file that anyone in the account can open.

What goes wrong

Your Storage policies decide who can download a file, and they are written separately from the rules on your tables. A record can be private while the receipt or contract attached to it stays readable. Files in a public bucket can be opened by anyone who has the link.

How to check

  1. Open Storage in the Supabase dashboard and note which buckets are public and which are private.
  2. Ask your developer to list the policies on storage objects and explain each one in a sentence.
  3. Sign in as a second user and try to download a file that belongs to the first user.
  4. Check that private files are shared through signed links that expire.

How to fix

Keep user files in private buckets. Tie each file policy to the owner of the record the file belongs to, and move existing files if their folder layout does not allow that.

What good looks like: User files sit in private buckets, and a second user gets an error when they request someone else’s file.

Source: Supabase: Storage buckets

What we saw in an audit

In one audit, every table had RLS switched on, and receipts on private records could still be downloaded by any member of the same account.

Sample report based on a real audit. Client details and figures changed.

Rather have someone run this check for you?

Have your Supabase rules tested
Check who can download your private files | Valletta