Skip to content

fix(cli): resolve unset auto_expose_new_tables to false and revoke all on sequences - #7313

Closed
krushit1307 wants to merge 1 commit into
supabase:developfrom
krushit1307:fix/issue-7286
Closed

krushit1307 wants to merge 1 commit into
supabase:developfrom
krushit1307:fix/issue-7286

Conversation

@krushit1307

Copy link
Copy Markdown

Summary

  • Resolves unset [api].auto_expose_new_tables to false in applyApiPrivileges, aligning the npm CLI with the hosted-project default and the Go implementation.
  • Updates START_REVOKE_API_PRIVILEGES_SQL and Go's RevokeDefaultDataApiPrivilegesSql to revoke all on sequences instead of usage, select, ensuring update privilege is revoked so non-privileged roles cannot call nextval/setval.
  • Updates effectiveShadowApiGrantsKept in the shadow cache to match the new resolution.
  • Updates schema descriptions in @supabase/config and the generated JSON schema artifacts.

Linked issue

Closes #7286

  • The linked issue is open and carries the open-for-contribution label (or I'm a Supabase maintainer).

Checklist

  • The PR title follows Conventional Commits (e.g. fix(cli): …).
  • Tests added or updated for the change.
  • From the repository root, pnpm check:all passes; relevant package tests pass for every touched workspace, and pnpm types:check passes for each touched TypeScript workspace (or workspace declaring it).

@krushit1307
krushit1307 requested a review from a team as a code owner October 23, 2026 17:49
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks! The linked issue hasn't been marked open-for-contribution yet, so this pull request is being closed automatically.

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.
See CONTRIBUTING.md for the full workflow. Once a maintainer adds the open-for-contribution label to a linked open issue, reopen or open a new pull request and it will be accepted.

@github-actions github-actions Bot closed this Oct 23, 2026
autoExposeNewTables: Option.Option<boolean>,
) {
if (Option.getOrElse(autoExposeNewTables, () => true)) return;
if (Option.getOrElse(autoExposeNewTables, () => false)) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm supabase@2.121.0 auto-exposes new public tables again when [api].auto_expose_new_tables is unset (regression of v2.106.0)

1 participant