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 1o437x-00009G-89 for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jun 2022 16:22:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o437v-0008TR-BR for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jun 2022 16:22:47 +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 1o437u-0008TI-Li for pgsql-hackers@lists.postgresql.org; Wed, 22 Jun 2022 16:22:47 +0000 Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o437n-0000jl-Oq for pgsql-hackers@lists.postgresql.org; Wed, 22 Jun 2022 16:22:45 +0000 Received: by mail-vs1-xe32.google.com with SMTP id j6so9350607vsi.0 for ; Wed, 22 Jun 2022 09:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=xfsjGpVQvRJiZ9E+AZkfO77DKzzu4mgOivne6InPG0s=; b=n07oq1Vd/xDPdPVNEsa+FeMG5anE6dwvLiMiTyi96+wDBazLZvdT8oBzWhXiI/PktR qNuNYJRia+qe1rk1NPXVQ1oI+CJxTeGooatl7ZjMs5VewNFasjvd0GbIDznX94quUiBj D1VuhODDojY025pakEQYCd/WsUxOWiVZ3hjw27Yyf+XVf50oti9MiqStKrNbH1MYa9wX dja8xI/B/Hfh5h9ylPoMXwIISnq5hQRHP9WYUn65F36mOhsS4KRav7EOTA165oumer5N QNyUHKjJhWNdxNl8aPE2LtDI4jG6ihfip0jnzn+Tu3yrd3vS9/RFzBwlfeTHcsNBWPdw I3jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=xfsjGpVQvRJiZ9E+AZkfO77DKzzu4mgOivne6InPG0s=; b=Ap8O+u0lqJzDlrPf+zYha7GVqf0C3n9fbiXDJPFyOvkRlZL2PdSwq7T/uRByY4jRgO LWB0Jx7b73/dTZegUfu+wWH1uP3QXgqGdrdkOP4353ksrIWp0Z1/wftCfAZbrqgacQuE 3mh9NUvdsw+g9dQfQ1Ch/yQxlWN67t3doKQgj1WN7YBFw1e4KSsIHbAPn/L8aInZf8dS bMBFUElrWMoCY2cAKR/aTurNJnaRgZYFH0rf8lrx6XVcJ7zn+oP1P1ccwP+Ps9Q+hGjF EV6BZWFrUcGnawIA24ib7YQGl1ao2xwJP0rrXnKhRn9z50eX6dAk58XGglRTre99nyCF 1t/w== X-Gm-Message-State: AJIora8vV/1q77ZDRiC/jmwR04Hx1CpYZxMswGH55loWl/XuScqw7xzH 2nfWKf3QAdCTRmmwpwaQ6ITEuQ== X-Google-Smtp-Source: AGRyM1sWUixVqCAXMM4gLHC72RzFOZTNPx+c4tE6DqD6lbD9CUwMTp/Z+3Lz1tE1izqvDgkkpq220g== X-Received: by 2002:a67:d603:0:b0:354:2ec8:7cdb with SMTP id n3-20020a67d603000000b003542ec87cdbmr7964421vsj.85.1655914958687; Wed, 22 Jun 2022 09:22:38 -0700 (PDT) Received: from [192.168.4.41] (072-017-018-098.res.spectrum.com. [72.17.18.98]) by smtp.gmail.com with ESMTPSA id m82-20020a1f2655000000b00357842240d4sm2619074vkm.49.2022.06.22.09.22.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jun 2022 09:22:37 -0700 (PDT) Message-ID: Date: Wed, 22 Jun 2022 12:22:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: SYSTEM_USER reserved word implementation Content-Language: en-US To: Tom Lane , Jacob Champion Cc: "Drouvot, Bertrand" , PostgreSQL Hackers References: <7e692b8c-0b11-45db-1cad-3afc5b57409f@amazon.com> <3338921.1655905757@sss.pgh.pa.us> <28b4a9ef-5103-f117-99e1-99ae5a86a6e8@joeconway.com> <3361134.1655909496@sss.pgh.pa.us> <89d0577e-b9f8-4d8a-224d-b336a5fe08af@joeconway.com> <3484653.1655913147@sss.pgh.pa.us> From: Joe Conway In-Reply-To: <3484653.1655913147@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/22/22 11:52, Tom Lane wrote: > Jacob Champion writes: >> On Wed, Jun 22, 2022 at 8:10 AM Joe Conway wrote: >>> In case port->authn_id is NULL then the patch is returning the SESSION_USER for the SYSTEM_USER. Perhaps it should return NULL instead. > >> If the spec says that SYSTEM_USER "represents the operating system >> user", but we don't actually know who that user was (authn_id is >> NULL), then I think SYSTEM_USER should also be NULL so as not to >> mislead auditors. > > Yeah, that seems like a fundamental type mismatch. If we don't know > the OS user identifier, substituting a SQL role name is surely not > the right thing. +1 agreed > I think a case could be made for ONLY returning non-null when authn_id > represents some externally-verified identifier (OS user ID gotten via > peer identification, Kerberos principal, etc). But -1 on that. I think any time we have a non-null authn_id we should expose it. Are there examples of cases when we have authn_id but for some reason don't trust the value of it? -- Joe Conway RDS Open Source Databases Amazon Web Services: https://aws.amazon.com