Skip to content
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

fix: Reduce postgres user grants #1159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/realtime/tenants/migrations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ defmodule Realtime.Tenants.Migrations do
FixWalrusRoleHandling,
UnloggedMessagesTable,
LoggedMessagesTable,
FilterDeletePostgresChanges
FilterDeletePostgresChanges,
ReduceGrantsPostgresUser
}

@migrations [
Expand Down Expand Up @@ -109,7 +110,8 @@ defmodule Realtime.Tenants.Migrations do
{20_240_618_124_746, FixWalrusRoleHandling},
{20_240_801_235_015, UnloggedMessagesTable},
{20_240_805_133_720, LoggedMessagesTable},
{20_240_827_160_934, FilterDeletePostgresChanges}
{20_240_827_160_934, FilterDeletePostgresChanges},
{20_240_919_140_541, ReduceGrantsPostgresUser}
]
defstruct [:tenant_external_id, :settings]
@spec run_migrations(map()) :: :ok | {:error, any()}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
defmodule Realtime.Tenants.Migrations.ReduceGrantsPostgresUser do
@moduledoc false
use Ecto.Migration

def change do
execute("revoke supabase_realtime_admin from postgres")

execute("revoke all on table realtime.schema_migrations from postgres")
execute("grant select on table realtime.schema_migrations to postgres with grant option")

execute("revoke all on table realtime.messages from postgres")
execute("grant select on table realtime.messages to postgres with grant option")

execute("revoke all on table realtime.subscription from postgres")
execute("grant select on table realtime.subscription to postgres with grant option")
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
def project do
[
app: :realtime,
version: "2.32.11",
version: "2.32.12",
elixir: "~> 1.16.0",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down
Loading