From: William Edwards <wedwards@cyberfusion.nl>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Sample pg_hba.conf allows local users to access all databases
Date: Wed, 02 Aug 2023 10:08:56 +0200
Message-ID: <54edc22f9addec5fcb8ea8190274cf06@cyberfusion.nl> (raw)
In-Reply-To: <CAKFQuwaEgcxAu-NFF+v57yedfrzWxdgc+b00fXd3gK3PT-7PeA@mail.gmail.com>
References: <07a0ac4f2b98152f355c64e967763924@cyberfusion.nl>
<CAKFQuwaEgcxAu-NFF+v57yedfrzWxdgc+b00fXd3gK3PT-7PeA@mail.gmail.com>
Hi David,
David G. Johnston schreef op 2023-08-01 19:35:
> On Tue, Aug 1, 2023 at 10:13 AM William Edwards
> <wedwards@cyberfusion.nl> wrote:
>
>> This allows all local users connecting over TCP to access all
>> databases,
>> not only the databases that the user is a member of as one might
>> expect.
>>
>> Proof that user is able to access database that it is not a member
>> of is
>> below.
>
> Roles do not gain membership in databases.
I mixed up \du and \l output (the latter has a 'Member of' column)
because I used identical names for some roles and databases. Sorry for
the confusion.
> Roles can be granted
> permissions on databases (mainly CONNECT). And all roles, via PUBLIC,
> get connect privileges on all databases by default. So the
> pg_hba.conf entry is not causing something to happen against the
> wishes of the privileges system.
>
> https://www.postgresql.org/docs/current/ddl-priv.html
>
> And yes, this is a usability vs secure-by-default that hasn't seen
> enough complaint to take on changing the default.
Understood - records in pg_hba.conf limit access preemptively during
client authentication and do not control privileges.
For completeness' sake: from what I understand, with default privileges,
this does allow users to manipulate and read objects in any 'public'
schema pre PostgreSQL 15.x
(https://www.postgresql.org/docs/15/release-15.html E.4.2).
>
> David J.
Met vriendelijke groeten,
William Edwards
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: wedwards@cyberfusion.nl, david.g.johnston@gmail.com
Subject: Re: Sample pg_hba.conf allows local users to access all databases
In-Reply-To: <54edc22f9addec5fcb8ea8190274cf06@cyberfusion.nl>
References: <07a0ac4f2b98152f355c64e967763924@cyberfusion.nl> <CAKFQuwaEgcxAu-NFF+v57yedfrzWxdgc+b00fXd3gK3PT-7PeA@mail.gmail.com> <54edc22f9addec5fcb8ea8190274cf06@cyberfusion.nl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox