- Home
- Skills
- Data & Databases
- Supabase Storage & Bucket Audit
Works with the AI Agents you already use
Supabase Storage & Bucket Audit
Most Supabase file leaks don't come from a clever attack.
$17
Supabase Storage & Bucket Audit
Example session with this skill installed
Check our Supabase Storage before launch. I want to know if any customer files are public or readable by other users. Also look at ./web for signed URLs that last too long. Don't change anything.
- Read your context and instructions
- Compiled the supabase storage
- Generated the data export
(Excerpt. Fictional demo data.)
Before I start: this audit only runs SELECT queries, inside a read-only transaction. I won't download or list your files, open your .env files, or print any key or link. If you want a fix applied, we'll do it one item at a time, with the undo shown first.
Ran the audit through psql (connection string from SUPABASE_DB_URL, which you set) and scanned ./web.
| Severity | Count |
|---|---|
| CRITICAL | 1 |
| HIGH | 4 |
| MEDIUM | 3 |
| LOW | 4 |
Top findings
- CRITICAL C05: web/.env.local line 4 defines NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY. That prefix puts it in the browser bundle, and the service role skips every Storage policy. Rotate the key in the dashboard first, then rename the variable and use it only on the server.
- HIGH B01: bucket
exportsis public. The object scan counted 212 .csv files and 3 .sql files, and 40 file names containing "export". Anyone with a link can download them without logging in. Proposed fix: make it private and switch the 2 getPublicUrl calls in web/lib/reports.ts to short signed URLs (steps and undo in the report). - HIGH P06: policy "Logged in can read invoices" only checks auth.uid() is not null, so any signed-in user can download every invoice in the private
invoicesbucket. Proposed fix: limit reads to the user's own folder. - HIGH C01: web/app/billing/page.tsx line 31 creates signed URLs for invoices that last 30 days. A signed URL can't be revoked one by one. Proposed fix: sign on the server with a few minutes' expiry when the user clicks.
- MEDIUM B02: bucket
uploadsaccepts anon uploads with no file type list. Proposed fix: allow only the image types the form needs and set a 5 MB limit.
Clean: avatars (public, images only), documents (private, owner-only policies), RLS on for both storage tables.
Not covered: links already handed out, file contents, server code that uses the secret key, and whether each bucket should be public for your app.
Want to start with item 1? Rotating the key is something you do in the dashboard; I'll then show the code change, what breaks, and how to check it worked.
page.tsx
CSV · data export
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Most Supabase file leaks don't come from a clever attack. They come from a bucket that was made public during a demo, a policy that only checks auth.uid() is not null, or a signed URL with a one-year expiry that ended up in a database column. This skill has your agent look for exactly those, on the live project, without changing anything.
What it checks
- Public buckets that look private. A public bucket serves every file to anyone with the URL, and Storage policies don't apply to those reads. The skill looks at the bucket name and, inside the database, counts file extensions, file names with words like "invoice", "passport" or "backup", and per-user folders. Only the counts come back; no file name or file content is read out. A public
avatarsbucket full of images passes. A publicexportsbucket with.csvand.sqlfiles is HIGH. - Upload limits. Public or writable buckets with no size limit or no allowed file types, so anyone allowed to upload can put any file type on your storage URL.
- Bucket policies. Anon uploads and deletes. Policies where any signed-in user can read, overwrite or delete other users' files (with anonymous sign-ins on, "signed in" can mean anyone). Private buckets made readable to everyone. Listing on public buckets. Policies tied to the user but not to a bucket.
user_metadatachecks and the deprecatedownercolumn. API roles that can change bucket settings, including the public flag. RLS off on the storage tables. - Signed URLs. Columns that store signed URLs, and, if you opt in, a count of rows that actually hold one.
- Your code (optional).
createSignedUrlcalls that last longer than an hour or a week (JavaScript/TypeScript, Python, Dart, Swift, Kotlin), signed URLs committed to the repo with whether they still work, service role or secret keys in client code or behindNEXT_PUBLIC_/VITE_/EXPO_PUBLIC_,getPublicUrlon private buckets, and signed URLs saved to the database. File and line only, never the value.
What you get
A Markdown report ranked CRITICAL to INFO. Each finding says who can do what today, in plain words, with a fix (SQL, dashboard steps or a code change), the undo, a Supabase docs link and an accept key. When it suggests making a bucket private, it lists the getPublicUrl calls that will break. There's a "checked and clean" list, a section on what the audit can't see, JSON output, and --fail-on high for CI.
How it relates to the Security Advisor
Supabase's Security Advisor has one Storage lint, for public buckets that allow listing, and this skill covers the same thing. The rest (bucket contents, upload limits, cross-user policies in Storage, signed URLs, your code) isn't covered by the advisor. The skill runs the advisor too, as a cross-check, when it can.
How it keeps you safe
- Read-only. The audit is a set of SELECT queries, run in a read-only transaction with psql. Your files are never downloaded or listed.
- No secrets in the chat. The agent never opens
.envfiles or asks for a password or key; you set the connection in your own terminal. Tokens and keys found in code are checked in memory and never printed. - Fixes are proposals, applied one at a time after you approve each one, on a branch, the local stack or a migration file first. Rotating keys and deleting leaked files stay your call.
Four ways to run it
psql, the Supabase CLI (supabase db query), the Supabase MCP server (execute_sql), or pasting one query into the dashboard SQL editor. No database access? The code scan runs on its own.
Tested
Tested on Postgres 16 and 17 against a mock Supabase Storage setup with 19 planted mistakes and 15 buckets and policies built correctly, plus a small sample app for the code scan. Every mistake was caught at the intended severity, every clean item passed, no file name leaked into the report, and the database was unchanged afterwards. The tests are included.
By Mausoft Skills. Supabase is a trademark of its owner; this skill is not affiliated with or endorsed by Supabase.
- Not yet run against a hosted Supabase project,
supabase db query --linked, Supabase CLI 3.x, or a live MCP connection. Tested on local Postgres 16 and 17 with a mock Supabase schema through psql, on 17 through CLI 2.122.1--db-url, and with the MCP and SQL editor result shapes through the parser. - Not tested on Postgres 15 or on Windows.
- Whether a bucket "looks private" is a guess from its name, file extensions and file name words. It can't know who should see a given file.
- The object scan looks at up to 20000 files per bucket by default, and undercounts if the database role is subject to RLS.
- Links already handed out can't be found from the database. The opt-in count only sees signed URLs stored in URL-like columns.
- Policies that call helper functions or subqueries are rated on their visible text and flagged for a manual read.
- The code scan works out expiries from literals and same-file constants; values from env vars or other files are listed for review. Client-side vs server-side is guessed from the folder layout.
- Dashboard-only settings (global upload limit, URL signing keys, image transformations) aren't visible from SQL.
- With the Supabase CLI path the SQL is SELECT-only but not wrapped in a read-only transaction.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 14 days ago
Requires
Permissions
Allowed Hosts
Supabase database: read access to bucket settings, storage policies and system catalogs through psql, the Supabase CLI, the Supabase MCP server, or the SQL editor (file names are only counted inside the database; files are never downloaded; writes only for fixes you approve one at a time) Optional: read-only access to your app's code folder (Storage calls, env variable names and key or URL shapes; values never printed)