supabase_auth_admin can CREATE roles

Open Beginner friendly
#1,518 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
postgres

Research direction

Start with the role-attributes query and its expected output in nix/tests/expected/auth.out, focusing on the supabase_auth_admin rolcreaterole value. Trace the role setup that produces this result, then verify the auth test output shows role creation is no longer permitted while the other attributes remain unchanged.

Written by the indexing model from the issue text.

Description

bug

Problem

The manager of the auth schema, supabase_auth_admin can create new roles on the database.

-- See https://github.com/supabase/postgres/blob/develop/nix/tests/expected/auth.out#L31
-- attributes of the supabase_auth_admin
select
  rolcreaterole  ,
  rolcanlogin    ,
  rolsuper       ,
  rolinherit     ,
  rolcreatedb    ,
  rolreplication ,
  rolconnlimit   ,
  rolbypassrls   ,
  rolvaliduntil
from pg_roles r
where r.rolname = 'supabase_auth_admin';
 rolcreaterole | rolcanlogin | rolsuper | rolinherit | rolcreatedb | rolreplication | rolconnlimit | rolbypassrls | rolvaliduntil 
---------------+-------------+----------+------------+-------------+----------------+--------------+--------------+---------------
 t             | t           | f        | f          | f           | f              |           -1 | f            | 
(1 row)

This is likely unneeded, and following the principle of least privilege, supabase_auth_admin shouldn't be able to.

Solution

Remove this privilege for suapbase_auth_admin.

Dominant language
Nix
Stars
1.8k
Forks
266
Avg merge
2d 8h
Merged PRs (30d)
25

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/postgres

All issues in supabase/postgres

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.