feat(config,stack): add auto_expose_new_tables configuration option#5239
Open
avallete wants to merge 2 commits into
Open
feat(config,stack): add auto_expose_new_tables configuration option#5239avallete wants to merge 2 commits into
avallete wants to merge 2 commits into
Conversation
…fault privileges Cloud now exposes a "Default privileges for new entities" toggle that, when disabled, revokes the default GRANTs to anon/authenticated/service_role on schema public so freshly-created tables, views, sequences, and functions are not reachable through the Data API without explicit GRANTs (supabase/supabase discussion #45329). Local Supabase had no equivalent: bootstrap always installed the default GRANTs, forcing users who opted in on cloud to keep their local schema out of sync or ship a project-specific revoke migration. Add an opt-in flag under [api] with default true (preserving today's local behaviour) and have the local DB bootstrap run the same revoke SQL Studio runs at cloud project creation when the flag is false. The flag is wired through both the Go CLI (covering `supabase db reset` and legacy `supabase start`) and the TypeScript stack bootstrap (covering the new `supabase start` foreground/background flows in apps/cli/next). https://claude.ai/code/session_011pZGRjHtkxjt1iZj5LYrqq
Coverage Report for CI Build 25785851202Coverage decreased (-0.01%) to 63.731%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions17 previously-covered lines in 4 files lost coverage.
Coverage Stats
💛 - Coveralls |
Fixes the "Check code quality" job failure on PR #5239 — the new [api].auto_expose_new_tables test block was committed in a non-canonical shape and oxfmt --check rejected it. https://claude.ai/code/session_011pZGRjHtkxjt1iZj5LYrqq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
auto_expose_new_tablesconfiguration option to control whether newly-created tables, views, sequences, and functions in thepublicschema are automatically exposed through the Data API roles (anon,authenticated,service_role).Summary
This change introduces a new configuration flag that allows local Supabase stacks to match the cloud default behavior where new entities require explicit GRANTs to be exposed through the Data API, rather than being automatically accessible.
Key Changes
Configuration Schema: Added
auto_expose_new_tablesboolean field to[api]config section (defaults totruefor backward compatibility)packages/config/src/api.tsapps/cli-go/pkg/config/api.goapps/cli-go/pkg/config/config.goDatabase Initialization: Modified postgres initialization to conditionally revoke default Data API privileges
REVOKE_DEFAULT_DATA_API_PRIVILEGES_SQLconstant in both TypeScript (packages/stack/src/services/postgres-init.ts) and Go (apps/cli-go/internal/db/start/start.go)auto_expose_new_tablesisfalse, the revoke SQL is executed after schema initialization to remove default GRANTsStack Configuration: Threaded the
autoExposeNewTablesflag through the stack builderPostgresConfiginterface to include the new optionCLI Integration: Connected project config to the local stack runtime
start.command.tsto readauto_expose_new_tablesfrom project config and pass it to stack configurationImplementation Details
true) preserves backward compatibility with existing local stacksfalse, new tables created by thepostgresrole in thepublicschema will not be accessible via the Data API until explicit GRANTs are issuedhttps://claude.ai/code/session_011pZGRjHtkxjt1iZj5LYrqq