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 1l5dNc-0005V0-Do for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Jan 2021 23:40:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l5dNb-0005dE-7L for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Jan 2021 23:40:43 +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 1l5dNb-0005d7-0v for pgsql-hackers@lists.postgresql.org; Fri, 29 Jan 2021 23:40:43 +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 1l5dNU-0001YQ-LY for pgsql-hackers@postgresql.org; Fri, 29 Jan 2021 23:40:42 +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 10TNeYZw2832059; Fri, 29 Jan 2021 18:40:34 -0500 From: Tom Lane To: Jacob Champion cc: "sfrost@snowman.net" , "pgsql-hackers@postgresql.org" Subject: Re: Proposal: Save user's original authenticated identity for logging In-reply-to: References: <20210129220101.GE27507@tamriel.snowman.net> <2829030.1611959442@sss.pgh.pa.us> Comments: In-reply-to Jacob Champion message dated "Fri, 29 Jan 2021 23:33:02 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2832057.1611963634.1@sss.pgh.pa.us> Date: Fri, 29 Jan 2021 18:40:34 -0500 Message-ID: <2832058.1611963634@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jacob Champion writes: > On Fri, 2021-01-29 at 17:30 -0500, Tom Lane wrote: >> What happens if ALTER USER RENAME is done while the session is still >> alive? > IMO the authenticated identity should be write-once. Especially since > one of my goals is to have greater auditability into events as they've > actually happened. So ALTER USER RENAME should have no effect. > This also doesn't really affect third-party auth methods. If I'm bound > as pchampion@EXAMPLE.COM and a superuser changes my username to tlane, > you _definitely_ don't want to see my authenticated identity change to > tlane@EXAMPLE.COM. That's not who I am. Ah. So basically, this comes into play when you consider that some outside-the-database entity is your "real" authenticated identity. That seems reasonable when using Kerberos or the like, though it's not real meaningful for traditional password-type authentication. I'd misunderstood your point before. So, if we store this "real" identity, is there any security issue involved in exposing it to other users (via pg_stat_activity or whatever)? I remain concerned about the cost and inconvenience of exposing it via log_line_prefix, but at least that shouldn't be visible to anyone who's not entitled to know who's logged in ... regards, tom lane