Features
Supabase Checks
DeployReady checks your Supabase migrations, compares them with the live database if you ask it to, and can show what your project exposes to the public anon key. It reports counts, not data, and it only runs live checks against a project you prove you own.
Three modes#
| Mode | Network | How to run |
|---|---|---|
| Static | None | Always on during analyze. |
| Drift | Your database, read-only | Opt in with --supabase-db-url. See Drift. |
| Live | Your Supabase project | Opt in with --supabase, or the MCP tool supabase_check_live (needs --allow-live). |
# static checks only (no network)
npx deployready@latest analyze .
# live, read-only checks against your own hosted project
export SUPABASE_URL=https://<ref>.supabase.co
export SUPABASE_ANON_KEY=... # public anon / publishable key
export SUPABASE_SERVICE_ROLE_KEY=... # proof of ownership (or SUPABASE_ACCESS_TOKEN)
npx deployready@latest analyze . --supabase
# local project from `supabase start` (no ownership proof needed)
SUPABASE_URL=http://127.0.0.1:54321 SUPABASE_ANON_KEY=... \
npx deployready@latest analyze . --supabaseStatic checks#
These read your files. Client-side code means a "use client" file, or src/, app/, or components/ in a Vite app. API routes, server/, supabase/functions, and *.server.* files are excluded.
| Rule | Severity | What it means |
|---|---|---|
supabase-service-jwt-client | critical | A key literal in client-side code decodes to role: service_role (or is an sb_secret_ key). |
supabase-service-jwt-public-env | critical | A public env var (NEXT_PUBLIC_, VITE_, EXPO_PUBLIC_, REACT_APP_, NUXT_PUBLIC_, PUBLIC_, GATSBY_) holds a service-role value, whatever the variable is called. |
The static pass also finds your project URL, the anon key, and your table names, so the live checks can use them.
Row-Level Security in your migrations#
Since 0.5.0 this check is migration-aware. DeployReady replays your SQL in order and judges only the final database state. Files under a migrations/ directory, such as supabase/migrations/<timestamp>_*.sql or Prisma's numbered folders, run first in natural filename order. Every other .sql file runs after them. It tracks schemas, quoted names, renames, unlogged tables, ENABLE, DISABLE, and FORCE row level security, CREATE, ALTER, and DROP POLICY, grants, and always-true conditions such as 1=1. A policy that was dropped, a table that was renamed, and RLS that was disabled and then re-enabled are all judged as they end up.
| Rule | Severity | What it means |
|---|---|---|
rls-not-enabled | critical on sensitive tables, otherwise warning | An API-exposed table ends up without RLS: never enabled, re-created after a DROP, renamed or moved into public, unlogged, or a partition of a protected parent. It fires only when the project is clearly Supabase or enables RLS elsewhere. |
rls-disabled | critical | The final word on an exposed table is DISABLE ROW LEVEL SECURITY. A disable that a later migration reverts is not reported. |
rls-permissive-policy | critical, warning, or not reported | A permissive policy is true for every row for anon or for any signed-in user, a restrictive policy does not narrow it, and the role holds the table privilege. |
rls-no-policy | info | RLS is on but no policy remains, so every request is denied. |
A check such as auth.role() = 'authenticated' verifies a role, not ownership, so it counts as open to any signed-in user. Anything the scanner cannot evaluate, such as owner checks, helper functions, or unparseable expressions, is treated as restrictive and never produces a finding.
Data sensitivity sets the severity#
- Sensitive tables are critical. A table is sensitive if
sensitiveTableslists it, its name suggests private data (invoices, payments, orders, messages, profiles, users, and so on), or it has a per-user or per-tenant column such asuser_idororg_id. - Unknown tables get a warning: review required, is public read intended?
- Public tables get no finding. A table is public if
publicTableslists it, it is catalog data (products, categories, tags), or it is content with a publish flag.
Open writes are critical on sensitive tables and a warning everywhere else. Only schemas served by the Data API count: public by default, or the [api] schemas list in supabase/config.toml, or exposedSchemas if you set it.
Project settings: .deployready.json#
Put a .deployready.json in the project root, or the same object under a "deployready" key in package.json:
{
"publicTables": ["announcements", "public.changelog"],
"sensitiveTables": ["widgets"],
"tenantColumns": ["shop_id"],
"exposedSchemas": ["public", "api"]
}Storage, functions, views, triggers, Realtime and grants#
Since 0.6.0 the same migration replay also tracks storage buckets (storage.buckets inserts, upserts, updates and deletes), policies on storage.objects, functions (SECURITY DEFINER, SET search_path, renames, GRANT and REVOKE EXECUTE, default privileges on functions), views and materialized views (security_invoker and the tables they read), triggers, the supabase_realtime publication, and column-level grants. They run when the project is clearly Supabase or uses RLS, and severity follows data sensitivity as for RLS.
Two Postgres facts the model follows, both checked on PostgreSQL 16: new functions are executable by PUBLIC, and Supabase also grants EXECUTE to anon and authenticated in public, so REVOKE ... FROM PUBLIC alone still leaves anon able to call it. And CREATE OR REPLACE VIEW without a WITH (...) clause drops security_invoker.
| Rule | Severity | What it means |
|---|---|---|
storage-bucket-public | critical when the bucket name looks private (invoices, documents, kyc, receipts, uploads, ...), warning when unknown, not reported for public assets (avatars, images, media, ...) | The bucket ends up public = true: anyone with a file path downloads it from /storage/v1/object/public/<bucket>/.... No storage.objects policy is checked. |
storage-policy-permissive | critical for reads of a private-looking bucket and for anon writes, warning otherwise | A storage.objects policy is true for every file of a bucket for anon or any signed-in user: it checks bucket_id (or a role) but never the owner. Each bucket in an OR is judged separately, and a restrictive policy that narrows it closes the gap. |
security-definer-rls-bypass | critical on sensitive tables, warning on unknown ones | A SECURITY DEFINER function in an exposed schema that anon or authenticated may execute reads or writes an RLS-protected table and never looks at the caller (auth.uid(), auth.jwt(), auth.role(), current_user). It runs as its owner, so POST /rest/v1/rpc/<fn> returns other users’ rows. |
security-definer-exposed | warning when anon may call it and the body never checks the caller, otherwise info | Any other SECURITY DEFINER function callable through the API. |
security-definer-search-path | warning (CWE-426) | A SECURITY DEFINER function without SET search_path in a project schema (Supabase-owned schemas are skipped). Names in its body resolve through the caller’s path, and a caller’s temporary table can shadow yours. |
view-rls-bypass | critical on sensitive tables, warning on unknown ones | A view in an exposed schema, readable by anon or authenticated, over an RLS-protected table, without security_invoker = true (PG15+) and without a caller filter in its query; or a materialized view there. Views run as their owner, so RLS does not apply. |
trigger-privilege-escalation | critical (CWE-269) | A SECURITY DEFINER trigger function writes a role or admin table (or role-like columns) from caller-controlled input: new.raw_user_meta_data on auth.users (set by whoever signs up), or new.role / new.is_admin on a table the caller can insert or update. new.raw_app_meta_data and fixed values are fine. |
realtime-table-exposed | critical on sensitive tables, warning on unknown ones | A table in supabase_realtime has no RLS or an always-true SELECT policy, so every change is pushed to any subscriber. |
grant-default-privileges-anon | warning for every schema or an exposed one, info for a private schema | ALTER DEFAULT PRIVILEGES ... GRANT write privileges on tables (or EXECUTE on functions) to anon or PUBLIC. Restating Supabase’s own defaults in public is not reported. |
grant-all-tables-anon | warning | GRANT ... ON ALL TABLES IN SCHEMA ... TO anon re-opens tables that an earlier REVOKE ... FROM anon had locked down. |
grant-sensitive-column | critical for credentials (password_hash, api_key, token, ...) or any anon read, warning for personal data (email, phone, ...) read by authenticated | A column-level GRANT SELECT includes a sensitive column and the role can read every row (no RLS, or an always-true SELECT policy). Column grants that leave such columns out are how Supabase projects hide them, and are not reported. |
Bucket settings go in .deployready.json: "publicBuckets": ["avatars"] and "sensitiveBuckets": ["exports"].
Edge Functions#
| Rule | Severity | What it means |
|---|---|---|
edge-function-no-auth | critical when the function uses the service-role key, warning when it only reads or writes data with the anon key | supabase/config.toml sets [functions.<name>] verify_jwt = false and the code (supabase/functions/<name>/index.ts, or entrypoint, plus files it imports by relative path) never authenticates the request. |
Accepted as authentication: auth.getUser() or getClaims(), jwtVerify or jwt.verify, helpers such as requireUser(req), webhook signature checks (stripe.webhooks.constructEvent, new Webhook(...), crypto.subtle.verify, HMAC, known signature headers), and a header compared with a secret environment variable. An anon-key client that forwards the caller's Authorization header stays under RLS and is not reported.
Coverage: supabase (static) is passed when the replay and these checks ran, and says how many verify_jwt = false functions were read (and which had no code in the project). It is failed when the object checks or the Edge Function check crash.
Ground truth. The project's supabase-deep corpus holds 23 cases, a vulnerable and a safe twin for each area (20 SQL cases and 3 Edge Function cases). Every SQL label was confirmed against PostgreSQL 16: anon reading every invoice through a view and an RPC, a user reading and deleting another user's documents, a signed-up user with {"role": "admin"}metadata ending up admin, a temporary table shadowing the table a definer function reads. Each safe twin is denied. This is the project's own corpus.
Drift: migrations versus the live database#
The migration replay tells you what your SQL files say. Drift detection compares it with the database itself. It is opt-in, read-only, and never connects unless you pass the flag. Setting SUPABASE_DB_URL alone does not connect.
deployready analyze . --supabase-db-url "postgres://readonly_user:...@db.<ref>.supabase.co:5432/postgres"
# or take the URL from the environment
SUPABASE_DB_URL=postgres://... deployready analyze . --supabase-db-urlUse a connection string you own; a read-only role is best. DeployReady replays your migrations, reads the live catalog, and reports where they differ. The session starts with default_transaction_read_only=on (verified with SHOW before any query), every query runs inside BEGIN READ ONLY ... ROLLBACK, and only catalog data is read: pg_class, pg_policies, information_schema.role_table_grants, pg_proc, pg_publication_tables, and storage.buckets (id and public only). No application row is selected, and the password is masked in every message and finding. The driver is pg, loaded only when drift runs.
| Rule | Severity | What it means |
|---|---|---|
drift-rls-disabled | critical | RLS is enabled in the migrations but disabled in the database. |
drift-table-unmanaged | critical / warning by sensitivity | An exposed table exists only in the database and has no RLS. |
drift-policy-added | critical / warning by sensitivity when it is always true and RLS is on, otherwise info | A policy exists only in the database. Its text is re-parsed with the same evaluator as the static checks. |
drift-policy-changed | by sensitivity when the live version opens every row, otherwise warning | Same name, but permissive/restrictive or command differ, or the live clause is always true while the migration’s is not. |
drift-policy-missing | warning for a restrictive policy, info for a permissive one | A policy from the migrations is missing in the database. |
drift-grant-added | warning | anon or authenticated hold a table privilege the migrations revoked. |
drift-function-definer, drift-function-search-path, drift-function-execute, drift-function-unmanaged | critical / warning | A function became SECURITY DEFINER, lost its search_path, became executable by anon or authenticated against the migrations, or is a definer function callable through the API that no migration defines. |
drift-view-invoker | by sensitivity of the view’s tables | The migrations create the view with security_invoker = true and the database view does not have it. |
drift-realtime-added | critical when the table has no RLS, otherwise warning | A sensitive table is in the live supabase_realtime publication but not in the migrations. |
drift-bucket-public | by bucket sensitivity | A bucket is public in the database but not in the migrations. |
Coverage has its own area, supabase (drift): passed when the catalog was read and compared, failed when the connection or a query failed (with the reason, password masked), and untested when it was not requested, was declined, or had no connection string or no migrations. It was tested against PostgreSQL 16 by applying the migrations, then mutating the database (RLS disabled, a using (true) policy added, security_invoker reset, a bucket made public), and a write through the drift session is refused.
Live checks#
| Rule | Severity | How it is proven |
|---|---|---|
supabase-anon-read | critical | A HEAD request with Prefer: count=exact and the anon key. If the Content-Range total is above 0, the table is exposed. Evidence is the count and at most 10 column names from the schema, never row values. |
supabase-rpc-anon-executable | warning | The function appears in the anon role’s own OpenAPI document, which means anon can execute it. No function is called. |
supabase-storage-public-bucket | warning | The storage API reports the bucket as public. |
supabase-storage-anon-list | critical | A list request with the anon key and limit 1 returns an object. Object names are not reported. |
supabase-open-signups | info | Auth settings report that sign-ups are enabled. |
supabase-email-confirm-off | info | Auth settings report that email confirmation is off. |
supabase-cross-user-read | critical | Opt-in with --supabase-cross-user. For tables with an owner column, DeployReady counts user B's rows as B (the control), then as user A. If A sees more than 0, A can read B's rows. |
Live runs probe at most 50 tables, 20 RPC functions, and 20 buckets. Every live finding carries proof: a reproducible curl command with keys shown as placeholders, the status, the Content-Range, and a control where one exists.
Credentials#
| Mode | You provide | Ownership proof |
|---|---|---|
| Local (supabase start) | SUPABASE_URL (loopback, such as http://127.0.0.1:54321) and SUPABASE_ANON_KEY | Not needed. A loopback URL is your machine. A service-role key is optional and adds totals and bucket metadata. |
| Hosted, service key | SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY | The key must be a service_role or sb_secret_ key. Its ref claim, if present, must match the URL. A call to the auth admin users endpoint must return 200. The response body is discarded unread. |
| Hosted, access token | SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_ACCESS_TOKEN | api.supabase.com must list the URL’s project ref. Needs a <ref>.supabase.co URL. Custom domains need the service key. |
| Cross-user (opt-in) | Add SUPABASE_TEST_USER_A_EMAIL, _A_PASSWORD, _B_EMAIL, _B_PASSWORD | Two test accounts you created. User B should own at least one row in the tables under test. |
The flags --supabase-url, --supabase-anon-key, --supabase-service-key, and --supabase-access-token override environment variables. Environment variables override values found in project files. Prefer environment variables for secrets, because flags end up in shell history. Secrets are never printed. The URL and anon key are the only values ever read from project files.
Safety#
- Ownership gate. The anon key is public, so holding it proves nothing. Without a loopback URL or a validated service key or access token for that project, the run is refused before any data request is sent.
- Read-only, counts only. Table probes are HEAD requests with limit 1, so no row content is transferred. The only POSTs are the password sign-in for opt-in test users and a storage list with limit 1. No RPC function is invoked.
- One bounded client. All traffic goes to one origin over https (http only for loopback), with at least 250 ms between requests, a 300-request budget, a 10 second timeout, no redirects, and a 5 MB response cap.
- Consent. Interactive runs ask before live checks start.
--yesskips the question. Over MCP, live checks exist only when the server was started with--allow-live, assupabase_check_live;supabase_checkwithlive: trueis refused without it.
Only test projects you own or are authorized to test. See also Security and privacy.