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 1oddHA-0003pL-4T for pgsql-general@arkaria.postgresql.org; Wed, 28 Sep 2022 20:03:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oddH8-0007sM-PA for pgsql-general@arkaria.postgresql.org; Wed, 28 Sep 2022 20:03:22 +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 1oddH8-0007sD-Eb for pgsql-general@lists.postgresql.org; Wed, 28 Sep 2022 20:03:22 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oddH4-0002dd-Tq for pgsql-general@lists.postgresql.org; Wed, 28 Sep 2022 20:03:22 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 6A4EA7CE3; Wed, 28 Sep 2022 22:03:17 +0200 (CEST) Date: Wed, 28 Sep 2022 22:03:17 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Limiting the operations that client-side code can perform upon its database backend's artifacts Message-ID: <20220928200317.2ntj7ejvysjje55a@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oe5qisi2pdp4vd4m" Content-Disposition: inline In-Reply-To: <5B23D9B8-56E8-458F-AD3D-B5F88AAB2844@yugabyte.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --oe5qisi2pdp4vd4m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2022-09-27 19:29:39 -0700, Bryn Llewellyn wrote: > I interpreted what Tom wrote to mean that he flatly rejected the idea > that a database design was possible that prevented a client session > that authorized as a role, that's designed for that purpose, from > dropping tables and otherwise arbitrarily corrupting stuff. I expect > that I completely misunderstood his point. I think you did. What he was saying was that a database design which uses only one single role which both owns all the objects and executes all code on behalf of the user can not be secure. At the very least you need two roles: One which owns the objects and one which can only use the objects in a way allowed by the business logic and is not allowed to change that logic (This is the case you demonstrated). In many cases this should be even more fine-grained, and at the extreme end every user could actually have several roles, each with only the minimal privileges required. (I have often observed that we tend to throw away and build permission systems at every layer of the stack: The OS has a system of users and permissions. But the database server runs as a single user (postgres) which has access to all the data files. So it has to implement its own system of roles and permissions. Then an application developer comes along and writes an app which uses a single database role which has access to all the data. So it again has to implement its own system of users and permissions ...) hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --oe5qisi2pdp4vd4m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmM0qIEACgkQ8g5IURL+ KF0Smw/+OiXwlZcTgP0N8a3D6+/V+hzeEEaOjKk0zYIpGkfu9ZmZk/BOZhD6pghP WEkovSdwFxrDYZB0gXJq3bto6QQiQ3zPsbKKG2PdcgUaUwAqIL1AAr2aqWOfkq+7 ruVTv2DLuS4XpNS54YLc3cMuk7Zhq//8LUQuflmX5Vt+q9kSTfzXwp6+vrLo5uwh IM7t5GRCYsu1wPAw/3GWxsSALTHbap+3ImPB06Or+WtjdiE30v/aI30IU4yTB2zA QKee90DflFR719CHdinSWsMUpGfMnrOQNBkd0q2FmBUIB/9UQ/PI6TxhPvqQFzCo EWpLS0PiS3iXpnd59HeGrcH/vNyMmR33NsOs2GFvi08H8uynx0ACO3dZ8bOvYOy2 YH8oYpChgnVBedt3vQG+yWy/ScldFiaTpFI2nBkiOpDyCDzy9v1RhzJm/iPryVCM dhV38XcXCd98Rj5oJ/pxspGCyARNDTJoLHsypHALy0NH6+TsEYhlaOiKWFsypdNK 3qwq7wkzLV2z0Eysl5m0UTd6i06QQnR97xtPTSTIvWHQrSdCMouG4dlUy7VeA4GQ K0bG3NzVQL8r5+eGaCzjlUCQBLInraFd/eYJhfE8k1JXpqrabE9Sa7/vwqIkRZ7n LL5r2dheubARBWP227IvnObFH8m5XrBYoB9uxePL1TA9JWjChhY= =kjsJ -----END PGP SIGNATURE----- --oe5qisi2pdp4vd4m--