From: Bryn Llewellyn <bryn@yugabyte.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Neeraj M R <neerajmr12219@gmail.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: Restricting user to see schema structure
Date: Thu, 12 May 2022 20:42:05 -0700
Message-ID: <1698CF2D-4F8E-41A6-AFF9-8FECFCFEA3D6@yugabyte.com> (raw)
In-Reply-To: <CAKFQuwZSC43dZYMVrw1m5M4Duxv2h56uJK2cvVcx9wLS5M+1Ng@mail.gmail.com>
References: <CANV4nBEqKefjxaBJkYrucGDLM41Tr0QehG2WBmoM_D2BXTUrfg@mail.gmail.com>
<e3b4ecf7-cda2-d47b-cc0e-2b91c3b1c127@aklaver.com>
<E9B37863-A142-4898-8BD6-85D46CF2CC29@yugabyte.com>
<048ab2c5-ddf6-d039-3c2a-1828d8c9137b@aklaver.com>
<CAKFQuwYmBFKrfTstgQPSRG-gAt-2Ne=vdQOfmEUL2Sy8x5S6Cg@mail.gmail.com>
<A0348203-9026-46A0-B53E-3720EA0401F6@yugabyte.com>
<CAKFQuwZSC43dZYMVrw1m5M4Duxv2h56uJK2cvVcx9wLS5M+1Ng@mail.gmail.com>
> david.g.johnston@gmail.com wrote:
>
>> bryn@yugabyte.com wrote:
>>
>> However, the design decision that, way back when, leads to this outcome does surprise me. The principle of least privilege insists that (in the database regime) you can create users that can do exactly and only what they need to do. This implies that my "client" should not be able to list all the objects in the database (and all the users in the cluster).
>
> If there was any motivation to improve PostgreSQL on this front I'd like them to start with "routine bodies" being hidden away from inspection. I'm much less concerned about pg_class or even knowing the names of things.
>
> This has been discussed a number of times, probably every few years or so. My quick search failed to find any relevant links/threads in the archives, though I didn't try that hard.
Thanks (again) David. Yes, there is an argument that when app developers know that hackers can read every minute detail of their implementation (but, with a sound user/schema/privileges discipline cannot change any of this), it cautions them to be extra scrupulous. SQL injection is maybe a good example. It's probably easier and quicker to scan PL/pgSQL source code looking for obvious patterns (like "any use of dynamic SQL?", "If yes, any concatenation of literals into the to-be-executed statement?", and so on) than it is to send robotically generated values via browser-UI screens in the hope of provoking tell-tale errors.
It certainly helps to know that nothing in how PG works in the space that's relevant here is going to change in my lifetime.
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: bryn@yugabyte.com, david.g.johnston@gmail.com, adrian.klaver@aklaver.com, neerajmr12219@gmail.com
Subject: Re: Restricting user to see schema structure
In-Reply-To: <1698CF2D-4F8E-41A6-AFF9-8FECFCFEA3D6@yugabyte.com>
References: <CANV4nBEqKefjxaBJkYrucGDLM41Tr0QehG2WBmoM_D2BXTUrfg@mail.gmail.com> <e3b4ecf7-cda2-d47b-cc0e-2b91c3b1c127@aklaver.com> <E9B37863-A142-4898-8BD6-85D46CF2CC29@yugabyte.com> <048ab2c5-ddf6-d039-3c2a-1828d8c9137b@aklaver.com> <CAKFQuwYmBFKrfTstgQPSRG-gAt-2Ne=vdQOfmEUL2Sy8x5S6Cg@mail.gmail.com> <A0348203-9026-46A0-B53E-3720EA0401F6@yugabyte.com> <CAKFQuwZSC43dZYMVrw1m5M4Duxv2h56uJK2cvVcx9wLS5M+1Ng@mail.gmail.com> <1698CF2D-4F8E-41A6-AFF9-8FECFCFEA3D6@yugabyte.com>
* 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