Repository navigation
fix(cli): resolve unset auto_expose_new_tables to false and revoke all on sequences - #7313
krushit1307 wants to merge 1 commit into
Conversation
|
👋 Thanks! The linked issue hasn't been marked A maintainer adds that label once an issue is triaged and ready to be worked on. Please wait for the label before opening a pull request. |
| autoExposeNewTables: Option.Option<boolean>, | ||
| ) { | ||
| if (Option.getOrElse(autoExposeNewTables, () => true)) return; | ||
| if (Option.getOrElse(autoExposeNewTables, () => false)) return; |
There was a problem hiding this comment.
🟡 Severity: MEDIUM
When unset, this branch runs the revoke SQL, but its per-schema revoke does not remove PostgreSQL's global default EXECUTE grant to PUBLIC (docs). Since anon inherits PUBLIC privileges, unauthenticated Data API clients can still call newly created public-schema RPC functions, including functions with sensitive behavior.
Helpful? Add 👍 / 👎
💡 Fix Suggestion
Suggestion: Update START_REVOKE_API_PRIVILEGES_SQL (and the Go RevokeDefaultDataApiPrivilegesSql equivalent) so it also revokes the default PUBLIC execute grant on functions. Add alter default privileges in schema public revoke execute on functions from public;. Run it for each role that creates objects, for example postgres and supabase_admin, using for role. PostgreSQL grants EXECUTE on new functions to PUBLIC globally, and anon and authenticated inherit it. Revoking only from anon, authenticated, service_role therefore does not close the gap. Keep the existing explicit revokes. Add a test that creates a function after bootstrap and checks that anon cannot execute it when auto_expose_new_tables is unset or false. Be aware that revoking PUBLIC execute also affects other roles, so confirm that internal roles keep the access they need.
Summary
[api].auto_expose_new_tablestofalseinapplyApiPrivileges, aligning the npm CLI with the hosted-project default and the Go implementation.START_REVOKE_API_PRIVILEGES_SQLand Go'sRevokeDefaultDataApiPrivilegesSqltorevoke all on sequencesinstead ofusage, select, ensuringupdateprivilege is revoked so non-privileged roles cannot callnextval/setval.effectiveShadowApiGrantsKeptin the shadow cache to match the new resolution.@supabase/configand the generated JSON schema artifacts.Linked issue
Closes #7286
open-for-contributionlabel (or I'm a Supabase maintainer).Checklist
fix(cli): …).pnpm check:allpasses; relevant package tests pass for every touched workspace, andpnpm types:checkpasses for each touched TypeScript workspace (or workspace declaring it).