Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npMCv-0008RN-V0 for pgsql-general@arkaria.postgresql.org; Fri, 13 May 2022 03:43:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1npMBv-0008Ap-Pt for pgsql-general@arkaria.postgresql.org; Fri, 13 May 2022 03:42:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npMBv-0008Af-DO for pgsql-general@lists.postgresql.org; Fri, 13 May 2022 03:42:11 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1npMBs-0003bf-5C for pgsql-general@lists.postgresql.org; Fri, 13 May 2022 03:42:10 +0000 Received: by mail-pj1-x102b.google.com with SMTP id w17-20020a17090a529100b001db302efed6so6626016pjh.4 for ; Thu, 12 May 2022 20:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yugabyte.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=2dPaqUvIyPNDB8OAEMspjYBNa654w20AZ/2pe2aA6NE=; b=WeodymbiiP5RDM0jZYIbdaqkM2P9v4gdnWzG5L7hvzwraLH31K8xxtKbg6b19wW2fo AqVQh1RNwqCvcC8oWu05v+6A0rarJk+vBmTzKARUWXGSut6JbiEFLURw85F7tZ+icF/m f+mE0DK6qJvtCu3ysNMYAkLdI81dKVhSbYrDo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=2dPaqUvIyPNDB8OAEMspjYBNa654w20AZ/2pe2aA6NE=; b=p7GxKOie2A6YbpGyM/Y8AIP1+Ug7OuN8Xo53SCDYRjwAkeb8NKtaQe+hdp8vqH9W9O JyDjzA0IBfh6TNIknJjM8HPiARrxrTJFvm15ZMKnyOQ7y8KZowI1e8+Ve8JVhonTvIr1 Xr70yteFH2aU4BWBjyXFINiLgtjeItePuHOb5bCElRZqTr2pzg+Rvpph+xUSzURSPOej 8bigbys0o9cLHQG1CDylP3YXCFMzd1APtllxcqDI1/sdXsebCj+36TFFBYNgflARVqAV VJ/Pzee6+AL9UTt5DnBfvRuER+W5E3CCs7PRnz/00Hzh2RHTn92Jai5vzsip9Fq7tXfl dZdA== X-Gm-Message-State: AOAM533YcT3k15GXeAAwBawRDG1V/8BMEmHqz+c/23mGFC5lH9R7e6eX x+TShmM8QSj1bJWlE88gnVinIg== X-Google-Smtp-Source: ABdhPJyjP2T7SUPRx6S3fEcEiCUqL4NyN/fkB8hmctGn8XFgLWZDi69UkDjduBrU+qZ/pPVlEEhn/w== X-Received: by 2002:a17:902:d48d:b0:15e:a480:78b2 with SMTP id c13-20020a170902d48d00b0015ea48078b2mr2791509plg.19.1652413326991; Thu, 12 May 2022 20:42:06 -0700 (PDT) Received: from smtpclient.apple ([2601:646:101:7fda:c1dc:acd8:40c:d1ba]) by smtp.gmail.com with ESMTPSA id l17-20020a629111000000b0050dc7628186sm584894pfe.96.2022.05.12.20.42.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2022 20:42:06 -0700 (PDT) From: Bryn Llewellyn Message-Id: <1698CF2D-4F8E-41A6-AFF9-8FECFCFEA3D6@yugabyte.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_CDE0E8A8-BEA6-46AD-B88C-3C8C338128EE" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Restricting user to see schema structure Date: Thu, 12 May 2022 20:42:05 -0700 In-Reply-To: Cc: Adrian Klaver , Neeraj M R , pgsql-general list To: "David G. Johnston" References: <048ab2c5-ddf6-d039-3c2a-1828d8c9137b@aklaver.com> X-Mailer: Apple Mail (2.3654.120.0.1.13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_CDE0E8A8-BEA6-46AD-B88C-3C8C338128EE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > david.g.johnston@gmail.com wrote: >=20 >> bryn@yugabyte.com wrote: >>=20 >> 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). >=20 > 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. >=20 > 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. --Apple-Mail=_CDE0E8A8-BEA6-46AD-B88C-3C8C338128EE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
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.

= --Apple-Mail=_CDE0E8A8-BEA6-46AD-B88C-3C8C338128EE--