Skip to content

Conversation

@sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented Oct 24, 2025

What kind of change does this PR introduce?

Bug fix

What is the new behavior?

We have these default privileges for all new tables created in public schema.

alter default privileges in schema public grant all on tables to postgres, anon, authenticated, service_role;

As a user, I may want to create a new table but revoke grants to anon role. For eg. my migration could look like this

create table public.test();
revoke all on table public.test from anon;

Now if I run the diff tool against an empty database, our inspection query finds a new table created with grants to authenticated and service_role only. So it generates the following sql

create table public.test();
grant all on table public.test to authenticated;
grant all on table public.test to service_role;

This is actually inconsistent with my desired state because the table public.test will still be granted to anon role due to the default privilege.

Hence, we are doing a 2nd pass to properly capture the revoke statements.

Additional context

Add any other context or screenshots.

@sweatybridge sweatybridge requested a review from a team as a code owner October 24, 2025 09:00
@coveralls
Copy link

coveralls commented Oct 24, 2025

Pull Request Test Coverage Report for Build 18775145968

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 7 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.03%) to 54.703%

Files with Coverage Reduction New Missed Lines %
internal/storage/rm/rm.go 2 80.61%
internal/gen/keys/keys.go 5 12.9%
Totals Coverage Status
Change from base Build 18771499447: -0.03%
Covered Lines: 6386
Relevant Lines: 11674

💛 - Coveralls

@sweatybridge sweatybridge merged commit 6d83868 into develop Oct 24, 2025
27 of 28 checks passed
@sweatybridge sweatybridge deleted the 2pass branch October 24, 2025 10:05
@github-actions github-actions bot mentioned this pull request Oct 28, 2025
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.

4 participants