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 1k48K4-0003Dd-6o for pgsql-general@arkaria.postgresql.org; Fri, 07 Aug 2020 19:46:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k48K3-0001vS-4S for pgsql-general@arkaria.postgresql.org; Fri, 07 Aug 2020 19:46:35 +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 1k48K2-0001vL-Sv for pgsql-general@lists.postgresql.org; Fri, 07 Aug 2020 19:46:34 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k48Jz-0001CC-9D for pgsql-general@lists.postgresql.org; Fri, 07 Aug 2020 19:46:34 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D25D27E2; Fri, 7 Aug 2020 15:46:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 07 Aug 2020 15:46:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=D CH8LpnMKpurzVAKoMXmZZIB1BLRNnlHs2Sj/vkRvZc=; b=aDcWFV9kVRv6X3b7X JuPTtJHS6ENbW4DFRtMoxym8D2H/9sBmjXT9T91UvensDfPMfn3yC+H+/6WlHE/M G3vGUIGZRJ2B8pbBFi6bL6RaajJSdESuHYtyOksIw3n9XqErQV/w4ovW946yVec0 rXG+J57EFXLmPtFdPVKzME0J73dOsM7a3LAibYHMj3qR6g6wMIG53cnzi8NvYvh2 l+OgUWU4YybPaIpACO4vhnuqK5HSSxAyIzVICYOTZZj4uTYAc0kd3a84Paru4KrY GLOwBpC9gYRpIveigCQBQWK3LtZjIT2MONNsmsZ5KZuIS92m8udpzQG0B1BWKgDV gKObA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=DCH8LpnMKpurzVAKoMXmZZIB1BLRNnlHs2Sj/vkRv Zc=; b=MDaQ1vdFbT43J2ahAbL7GudDw2mzNA80diPuUKCE7RmW5w8+C92amx1Fq KczmxdgGJqIz5mCUcwVIKYM3JMnUNbQ94d3KEti72Cur7nfcOVCRuf1wCLQAAn7A Qmy6JIxZHE7nxZ0Kk6+BWyZXEcMGSK5O+eVuns6kCP03fLRE+mlsbo1AmCOtxt6v ua+12qBmSiGKT5iQO3h9WAXIGhLTk3IBoXainLDSMPSNgslIRwRGj+dmmGOHy1TS +Ugdk+jIDpnBtAAUiC3zV3LS9I8oYYzYchzVcpgI8KUu7+7G4fN8+caCVA/0rjwj 4osGEYUE7kgsGJsoQALBcm9qI6ENw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrkedvgddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffhvfhfkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpefhleekveehgeffgfekjeffhfdujeeukeeivefhudeg keelgfefgeevheefieeiteenucfkphepjeehrddujedvrdehrddvfedunecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 859EB3280063; Fri, 7 Aug 2020 15:46:24 -0400 (EDT) Subject: Re: privileges oddity From: Adrian Klaver To: Scott Ribe Cc: Tom Lane , PostgreSQL General References: <20200806185329.GC29590@tamriel.snowman.net> <75f2f28c-9121-c3d0-0c9a-f9b16ef337fb@aklaver.com> <3DF00E97-6D2F-4329-AA0E-9CC2CCD41A8E@elevated-dev.com> <1ceb2a2f-50a0-ef7c-1849-6fa75dd61d64@aklaver.com> <5AA78DA8-746A-4407-AC00-B1463451CAD0@elevated-dev.com> <7efe4d40-5f8d-f3bb-45ff-fd00f3beba84@aklaver.com> <140C61E1-282D-42C2-8349-B5D11792DFCE@elevated-dev.com> <2793218.1596825900@sss.pgh.pa.us> <99994f76-5a45-09a1-c6e3-4021cb4bd385@aklaver.com> <997A0678-B203-432F-AF7D-7ADB6415C28A@elevated-dev.com> Message-ID: <0e84a002-4498-545d-4810-e0a64fbcd342@aklaver.com> Date: Fri, 7 Aug 2020 12:46:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/7/20 12:40 PM, Adrian Klaver wrote: > On 8/7/20 12:27 PM, Scott Ribe wrote: >>> On Aug 7, 2020, at 1:08 PM, Adrian Klaver >>> wrote: >>> >>> "Using this command, it is possible to either add privileges or >>> restrict one's privileges. If the session user role has the INHERIT >>> attribute, then it automatically has all the privileges of every role >>> that it could SET ROLE to; in this case SET ROLE effectively drops >>> all the privileges assigned directly to the session user and to the >>> other roles it is a member of, leaving only the privileges available >>> to the named role. On the other hand, if the session user role has >>> the NOINHERIT attribute, SET ROLE drops the privileges assigned >>> directly to the session user and instead acquires the privileges >>> available to the named role. >>> " >> >> So it would only have removed privs if I had used set role in the >> session, which I am not. >> > > See Tom's answer. To confirm do: > > SELECT >     s.setdatabase, >     s.setrole, >     rolname, >     s.setconfig, >     rolname ^^^^^^^ Surplus to requirements > FROM >     pg_db_role_setting AS s >     JOIN pg_roles AS r ON r.oid = s.setrole; > Also log in as 'akanzler' to psql and do: select session_user; select current_user; -- Adrian Klaver adrian.klaver@aklaver.com