Replies: 2 comments 2 replies
|
I'm not aware of a single Supabase switch that freezes writes from every path. The main reason is that anyone with the A layered setup that works well in practice:
Details for each of your questions: 1. SQL Editor: not with SQL alone. Admins can override database-level guards. Supabase's own read-only mode is a good example: it uses 2. Direct Postgres connections: limit access, then drain. A privileged connection can override application-level guards. Rotating the database password helps, but it isn't an immediate barrier: existing sessions stay connected, and Supavisor can briefly keep accepting the old password (details). Rotate it, then drain or terminate existing writer connections. 3. Service role: yes, with table privileges, but audit first. The service role bypasses RLS, but not table privileges. You can Deleting a secret key revokes it instantly, but any other secret keys and enabled legacy keys keep working, so review all of them (API keys). 4. Auth user deletion: no documented pause switch. Deleting a user through the API needs a secret/service key or dashboard access, so restricting those covers most of it. Privileged SQL can also delete directly from For foreign-key side effects: 5. pg_cron: yes, it's supported. Toggle jobs off in the Dashboard, or run 6. Global guarantee: not one I'm aware of. Use the layered setup above. For a strict maintenance boundary, stop new writers, drain in-flight work, and verify each access path is blocked. Database guards add protection, but they can't constrain an administrator who can remove them. |
|
There is no platform-level global write lock, and any answer that implies one is wrong about how Postgres privileges work. What there is: six specific mechanisms, each covering one pathway, with one gap that is architectural rather than a missing feature. Ordered by pathway: 1. SQL Editor and any 2. Application roles ( -- every transaction of these roles is read-only by default, at the role level
alter role anon set default_transaction_read_only = on;
alter role authenticated set default_transaction_read_only = on;
-- revoke the write privileges outright (stricter; also removes the ability to opt out per-transaction)
revoke insert, update, delete, truncate on all tables in schema public from anon, authenticated;
revoke all on all sequences in schema public from anon, authenticated;The 3. service_role via the Data API — the supported way to constrain it to approved functions is the same shape as above at the object level: revoke insert, update, delete, truncate on all tables in schema public from service_role;
grant execute on function public.your_approved_write(jsonb) to service_role; -- security definer, owned by postgresThe Data API can then only reach what the functions expose. Caveat that matters: a 4. Managed Auth user deletion — cannot be suspended through SQL you can run. Deleting a user runs as the Auth service, and the foreign-key effects ( 5. select cron.unschedule(jobid) from cron.job;
-- and, to stop new schedules from taking effect during the window:
revoke all on schema cron from public; -- schedule creation requires the cron schemaUnscheduling is reversible with the original schedules recorded first — save them ( The honest answer to your question 6: no single mechanism guarantees exclusive write admission across all five pathways, because two of them (admin SQL and managed Auth) are platform-owned by design. The closest supported architecture is: role-level read-only defaults plus revokes on the application roles (covers Data API and app traffic), function-only grants on |
Uh oh!
There was an error while loading. Please reload this page.
Hello Supabase community,
I am evaluating the safety architecture for a Supabase Hosted PostgreSQL 17 application that requires a temporary maintenance window during which application data mutations must be blocked across all possible write pathways.
I would appreciate clarification on the following platform capabilities:
SQL Editor: Is it possible to restrict privileged SQL writes during a maintenance window, including operations executed by project administrators?
Direct PostgreSQL access: Can database-level permissions or platform controls prevent privileged connections from bypassing application-level write guards?
Service Role: Can service-role Data API mutations be constrained to specific approved server-side functions rather than arbitrary table writes?
Supabase Auth: Can managed Auth user deletion be suspended or restricted during maintenance, including indirect PostgreSQL foreign-key effects such as
ON DELETE SET NULL?Scheduled jobs: Is there a supported way to reliably suspend or block
pg_cronand other privileged background writes during maintenance?Global write isolation: Does Supabase Hosted provide a supported mechanism that guarantees exclusive write admission across SQL Editor, direct PostgreSQL, Data APIs, managed Auth, and scheduled jobs?
If a global guarantee is not available, what architecture or operational controls would you recommend?
I am asking for general platform documentation and supported capabilities only. No production access, investigation, or changes are requested.
Thank you for your guidance.
All reactions