Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 516
feat(api): flip auto_expose_new_tables default to false#5524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
85c8987
feat(cli): flip api.auto_expose_new_tables default to revoke and depr…
claude a16f312
test(cli): extract MockApiPrivilegesRevoke helper for revoke SQL mocks
claude fda05ee
test(cli): mock api privilege revoke in start and squash suites
claude c8e7d98
Merge remote-tracking branch 'origin/develop' into claude/magical-gat…
claude 821a9ec
test(cli): mock api privilege revoke in SetupShadowDatabase test
claude 2aee3d0
fix(cli): key declarative cache on effective auto_expose default
claude ced8cd7
Merge branch 'develop' into claude/magical-gates-32n00o
avallete File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -415,15 +415,16 @@ alter default privileges for role postgres in schema public | ||
| // `[api].auto_expose_new_tables` flag in config.toml. The flag is tri-state to give users a | ||
| // safe migration window: | ||
| // | ||
| // - unset (default today): keep the bundled initial-schema GRANTs in place, so local matches | ||
| // long-standing behaviour. This implicit default flips to false on May 30, 2026, and the | ||
| // flag is removed entirely in October 2026 (always-revoked behaviour). | ||
| // - true: explicit opt-in to today's behaviour. Treated identically to unset for now; from | ||
| // May 30 the CLI will warn that the flag is being deprecated. | ||
| // - false: revoke the default Data API GRANTs so newly-created entities in `public` require | ||
| // explicit GRANTs to surface through the Data API, matching the new cloud default. | ||
| // - unset (default): revoke the default Data API GRANTs so newly-created entities in `public` | ||
| // require explicit GRANTs to surface through the Data API, matching the new cloud default. | ||
| // The implicit default flipped to false on May 30, 2026; the flag is removed entirely in | ||
| // October 2026 (always-revoked behaviour). | ||
| // - true: explicit opt-in to the legacy behaviour of keeping the bundled initial-schema GRANTs | ||
| // in place. Deprecated: config loading warns that the flag is removed on October 30, 2026. | ||
| // - false: revoke the default Data API GRANTs (same as unset). Kept so users can pin the new | ||
| // behaviour explicitly during the deprecation window. | ||
| func ApplyApiPrivileges(ctx context.Context, conn *pgx.Conn) error { | ||
| if utils.Config.Api.AutoExposeNewTables == nil || *utils.Config.Api.AutoExposeNewTables { | ||
| if utils.Config.Api.AutoExposeNewTables != nil && *utils.Config.Api.AutoExposeNewTables { | ||
| return nil | ||
avallete marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| file, err := migration.NewMigrationFromReader(strings.NewReader(RevokeDefaultDataApiPrivilegesSql)) | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package helper | ||
| import "github.com/supabase/cli/pkg/pgtest" | ||
| // MockApiPrivilegesRevoke queues the per-statement responses for the default Data API privilege | ||
| // revoke that start.ApplyApiPrivileges runs when [api].auto_expose_new_tables is unset or false. | ||
| // | ||
| // The statements mirror start.RevokeDefaultDataApiPrivilegesSql. They are inlined here rather | ||
| // than imported from the start package to avoid an import cycle with that package's own | ||
| // internal (package start) tests. | ||
| func MockApiPrivilegesRevoke(conn *pgtest.MockConn) *pgtest.MockConn { | ||
| conn.Query("alter default privileges for role postgres in schema public\n revoke select, insert, update, delete on tables from anon, authenticated, service_role"). | ||
| Reply("ALTER DEFAULT PRIVILEGES"). | ||
| Query("alter default privileges for role postgres in schema public\n revoke usage, select on sequences from anon, authenticated, service_role"). | ||
| Reply("ALTER DEFAULT PRIVILEGES"). | ||
| Query("alter default privileges for role postgres in schema public\n revoke execute on functions from anon, authenticated, service_role"). | ||
| Reply("ALTER DEFAULT PRIVILEGES") | ||
| return conn | ||
| } |
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.