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 1odOGl-0000Iq-Mf for pgsql-general@arkaria.postgresql.org; Wed, 28 Sep 2022 04:01:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1odOFl-0002Gz-Cg for pgsql-general@arkaria.postgresql.org; Wed, 28 Sep 2022 04:00:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odOFl-0002Gq-1Q for pgsql-general@lists.postgresql.org; Wed, 28 Sep 2022 04:00:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odOFg-0004Pb-Am for pgsql-general@lists.postgresql.org; Wed, 28 Sep 2022 04:00:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 28S40djG3881882; Wed, 28 Sep 2022 00:00:40 -0400 From: Tom Lane To: Bryn Llewellyn cc: Julien Rouhaud , "Peter J. Holzer" , pgsql-general list Subject: Re: Limiting the operations that client-side code can perform upon its database backend's artifacts In-reply-to: References: <3D119733-6784-4E84-98E4-5124E69D43F9@yugabyte.com> <20220927065858.ibrmzrrbefjq5o4l@jrouhaud> <20220927222637.aolob6gk3kuyirfs@hjp.at> <87E125A5-A4B8-4BD6-9E9C-7ABF77650F3F@yugabyte.com> <20220928011353.zo7enlnig5vvpowe@jrouhaud> <5B23D9B8-56E8-458F-AD3D-B5F88AAB2844@yugabyte.com> <20220928025427.coznr3we5plyq5pp@jrouhaud> Comments: In-reply-to Bryn Llewellyn message dated "Tue, 27 Sep 2022 20:47:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3881880.1664337639.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 28 Sep 2022 00:00:39 -0400 Message-ID: <3881881.1664337639@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bryn Llewellyn writes: > rjuju123@gmail.com wrote: >> I'm not convinced... that the authorization system can prevent an untru= sted user with a direct SQL access from actually hurting you. > What do you mean by "untrusted"? Any person who is given the credentials > to start a database session is trusted=E2=80=94even a person who can con= nect as > a superuser and do untold harm. So focus on a person who has the > credentials to connect as "client" in my example. But imagine a design > that exposes functionality to "client" sessions exclusively through a > carefully designed and implemented API that's expressed exclusively with > user-defined functions and procedures. Sure. That is called an application server. What we are is a SQL server, and that means that the API is SQL commands, and the authorization model is what the SQL spec says it is. (Well, okay, there's some discrepancies between the letter of the spec and what we actually do. But my main point here is that any session authenticated as user X has the same privileges as any other session authenticated as user X, so there is not a lot of point in user X mounting defenses against user X.) So I think the concerns you're expressing here would be better addressed at the next level up the stack. regards, tom lane