Re: prevent users from SELECT-ing from pg_roles/pg_database

From: Muhammad Salahuddin Manzoor <salahuddin(dot)m(at)bitnine(dot)net>
To: Andreas Joseph Krogh <andreas(at)visena(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: prevent users from SELECT-ing from pg_roles/pg_database
Date: 2024-05-24 16:28:20
Message-ID: CAKD7CD=-RiQQq+Q-zC8cP5hmfG6icj1cUT0Ebx8a=gwyp=dR1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

To prevent a user or role from selecting data from certain system tables in
PostgreSQL, you can revoke the default select permissions on those tables.
Here’s how you can do it:

1. Revoke SELECT permission on the system tables from the public role.
2. Grant SELECT permission only to specific roles that need it.

Here’s a step-by-step guide on how to achieve this:

Salahuddin.

On Fri, 24 May 2024, 20:52 Andreas Joseph Krogh, <andreas(at)visena(dot)com> wrote:

> 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.
>
>
>
> Thanks.
>
>
> --
> *Andreas Joseph Krogh*
> CTO / Partner - Visena AS
> Mobile: +47 909 56 963
> andreas(at)visena(dot)com
> www.visena.com
> <https://www.visena.com>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-05-24 17:02:13 Re: prevent users from SELECT-ing from pg_roles/pg_database
Previous Message Andreas Joseph Krogh 2024-05-24 15:51:59 prevent users from SELECT-ing from pg_roles/pg_database