Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tmFTN-005Ese-9B for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Feb 2025 17:08:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tmFTM-00Bl38-Ek for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Feb 2025 17:08:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tmFTL-00Bl30-W7 for pgsql-hackers@lists.postgresql.org; Sun, 23 Feb 2025 17:08:56 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tmFTH-000KaG-1b for pgsql-hackers@postgresql.org; Sun, 23 Feb 2025 17:08:54 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id E5712276CD0 for ; Sun, 23 Feb 2025 18:08:48 +0100 (CET) Received: from s899.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id D17DF2776B0; Sun, 23 Feb 2025 18:08:48 +0100 (CET) Received: from s473.loopia.se (unknown [172.22.191.6]) by s899.loopia.se (Postfix) with ESMTP id CE8D82C8B9F9; Sun, 23 Feb 2025 18:08:48 +0100 (CET) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s473.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=yesql.se Received: from s979.loopia.se ([172.22.191.6]) by s473.loopia.se (s473.loopia.se [172.22.190.13]) (amavisd-new, port 10024) with LMTP id cHp2GHCNykZS; Sun, 23 Feb 2025 18:08:48 +0100 (CET) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s979.loopia.se (Postfix) with ESMTPSA id 5660A10BC3C8; Sun, 23 Feb 2025 18:08:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1740330528; bh=rQd591dTUqhQuvyLh9oVuPPuAMdWr3pr/2m63gsLMCg=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=n3EWsDttfVtRvFY5h70Phoc1vZWGAMB7eTKGxvJVlrdgQTOkfXFn6+FBWoPof2ozo ZH+zt+iLmdJJbBqy9JI7YcXgLhOOglFV+Jc6Jm3k38LuCiNaQBJhTx0QLexx5bVdUO RGs65ffd4DWY0R6Vge6s90QNklZWMkRuN2Oj3isGxX7nnwTB/xHTJuNjByvbisRwBd bNb+SoACNrlcMEd9BKolmN69+7sOcWPaPES9vTDNcqF2zDchynAI3H5BqkQrJdLXhJ VJfa1psalBgeyqHR6BhH+3t6Z5u4bRWzaBKEgGRE8CvU3y3V3pDk2ah5NTUMM4Umw0 PbCvAySAZoERA== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER From: Daniel Gustafsson In-Reply-To: <912516.1740329361@sss.pgh.pa.us> Date: Sun, 23 Feb 2025 18:08:37 +0100 Cc: Jacob Champion , Peter Eisentraut , Antonin Houska , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <6bde5f56-9e7a-4148-b81c-eb6532cb3651@eisentraut.org> <9B417838-B872-453D-BBFB-99FA957EB723@yesql.se> <54c008ad-1c23-47d8-ba6c-bed98a39c31c@eisentraut.org> <06102deb-00ef-431d-a3ea-65afb24! 6700a@eisentraut.org> <39A09EC8-2D72-4130-8C3E-8F3D1CC69A12@yesql.se> <55EA9E76-9866-486C-9C7F-C5E8B071C50E@yesql.se> <35CBB6AD-B847-4C26-9A7B-019279F280C8@yesql.se> <9F184CFE-ED8D-4B86-9529-F07821108C93@yesql.se> <83C44AB4-24B0-437F-B139-B5CBC5821BB1@yesql.se> <2A1511A0-C04B-47E4-B1C3-54C2A1C765B8@yesql.se> <13F329B6-86BC-40A5-96F4-102784A0357A@yesql.se> <912516.1740329361@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3776.700.51.11.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 23 Feb 2025, at 17:49, Tom Lane wrote: >=20 > Daniel Gustafsson writes: >> I spent a few more hours staring at this, and ran it through a number = of CI and >> local builds, without anything showing up. Pushed to master with the = first set >> of buildfarm animals showing green builds. >=20 > Coverity has a nit-pick about this: >=20 > = /srv/coverity/git/pgsql-git/postgresql/src/interfaces/libpq/fe-auth-oauth.= c: 784 in setup_token_request() > 778 if (!request_copy) > 779 { > 780 libpq_append_conn_error(conn, "out of memory"); > 781 goto fail; > 782 } > 783 =20 >>>> CID 1643156: High impact quality (WRITE_CONST_FIELD) >>>> A write to an aggregate overwrites a const-qualified field = within the aggregate. > 784 memcpy(request_copy, &request, sizeof(request)); > 785 =20 > 786 conn->async_auth =3D run_user_oauth_flow; > 787 conn->cleanup_async_auth =3D cleanup_user_oauth_flow; > 788 state->async_ctx =3D request_copy; > 789 } >=20 > This is evidently because of the fields declared const: >=20 > /* Hook inputs (constant across all calls) */ > const char *const openid_configuration; /* OIDC discovery URI */ > const char *const scope; /* required scope(s), or NULL */ >=20 > IMO, the set of cases where it's legitimate to mark individual struct > fields as const is negligibly small, and this doesn't seem to be one > of them. Thanks for the report, will fix. > BTW, as another nitpicky style matter: why do PGoauthBearerRequest > etc. spell their struct tag names differently from their typedef names > (that is, with/without an underscore)? That is not our project style > anywhere else, and I'm failing to detect a good reason to do it here. Indeed it isn't, the only explanation is that I missed it. Will fix. -- Daniel Gustafsson