Re: prevent users from SELECT-ing from pg_roles/pg_database - Mailing list pgsql-general

From Tom Lane
Subject Re: prevent users from SELECT-ing from pg_roles/pg_database
Date
Msg-id 671405.1716570133@sss.pgh.pa.us
Whole thread Raw
In response to prevent users from SELECT-ing from pg_roles/pg_database  (Andreas Joseph Krogh <andreas@visena.com>)
Responses Re: prevent users from SELECT-ing from pg_roles/pg_database
Re: prevent users from SELECT-ing from pg_roles/pg_database
List pgsql-general
Andreas Joseph Krogh <andreas@visena.com> writes:
> Hi, is there a way to prevent a user/role from SELECT-ing from certain 
> system-tables?
> I'd like the contents of pg_{user,roles,database} to not be visible to all 
> users.

As noted, you can in principle revoke the public SELECT grant from
those views/catalogs.  However, the system is not designed to hide
such information, which means you'll have (at least) two kinds of
issues to worry about:

1. Queries or tools breaking that you didn't expect to break.
It's hardly uncommon for instance for queries on pg_class to
join to pg_roles to get the owner names for tables.

2. Information leaks.  For example, mapping role OID to role name
is trivial with either regrole or pg_get_userbyid(), so it
wouldn't take long to scan the plausible range of role OIDs and
get all their names, even without SQL access to the underlying
catalog.

            regards, tom lane



pgsql-general by date:

Previous
From: Muhammad Salahuddin Manzoor
Date:
Subject: Re: prevent users from SELECT-ing from pg_roles/pg_database
Next
From: Muhammad Salahuddin Manzoor
Date:
Subject: Re: prevent users from SELECT-ing from pg_roles/pg_database