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 1tmcUK-0088z7-E1 for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2025 17:43:29 +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 1tmcUJ-005qeY-FC for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2025 17:43:27 +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 1tmcR9-005laD-DI for pgsql-hackers@lists.postgresql.org; Mon, 24 Feb 2025 17:40:11 +0000 Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tmcR6-000W6W-1y for pgsql-hackers@postgresql.org; Mon, 24 Feb 2025 17:40:10 +0000 Received: by mail-qv1-xf32.google.com with SMTP id 6a1803df08f44-6e670d29644so36995096d6.3 for ; Mon, 24 Feb 2025 09:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1740418809; x=1741023609; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0MWsORyLyezDB4W1/U+CXT7tBfcOQKrTTUaesb1RSzc=; b=dtshVdBwmWK2L/URRpd5IqxTAqlVa6OXktaLXOEloek3dCyNBJf9skwFgneKlCOOTF YqJ+ljsKdpaObZcA64S9C7rHzOr3z0e69SoTCsYoDpSOlsHWur3JRzyRwX8N0I2EcfCk nmgKlvoO8Yv3znJGNzu8oxBxzzwCUsm40MfkzIZoBVn25oDE9xgMjoN1ZpF7+abCxRP4 pYBL8VbEDQezYNyNb6kjGNfjimLKMZH2JKlA4SWJR35+3fYHbCj6Xcn/ZuyH1CHtEWbX xHI5ROXinTn/1AoQNRy37G3PlqZmfJPStAvOLE11Cugz8FskSlPlymH237xzid3Y68bD k82Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740418809; x=1741023609; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0MWsORyLyezDB4W1/U+CXT7tBfcOQKrTTUaesb1RSzc=; b=gFitEihcKyHSQ6Dd6bCFkNGtWV9LHmSMGA9Xj2g8xrSxHE7iOiisAr2UrXcWsWtYGc Uh2ZRi2UHsJKkeUv16NCrgSpJTN07zBrtE7CgI968vwEta5IJ76BZQRooAI7AmTSeDGV m5u3L3XM6/1S1uN8lHL9PSqtUtjvuSAuSgP/DO0sEapE3ouXb2PuwxCSvNjKKbZhs7uX u8vZD4354Cvaih0hnRu6JVxAIeFScFgnxjwhTsX2XjQ7tzRx3ldtqBmy9Hz4jggWzAgU YncM031vkSqa8NNyrmBaRXxp0Hf6DT2bwyB8Rd5ZcX6CAVqJ44ZuZdKI0UBIvYYvJBLX 6Q1g== X-Forwarded-Encrypted: i=1; AJvYcCVea7zWCT9Vq8mBXsH7kdDa54wrYvcSx7ix5JDh2//8pnzcIOhmgQkUjhRXx2WduXOe2MwqO38u/plWWgmi@postgresql.org X-Gm-Message-State: AOJu0YzTcxQPoMXWyXFbrkyCkbCNYOO6kmt3c8ckBgCDD/nRQl8QUI50 PC+cZhRKsspjib2JHOP7qLyOBKNFKBrbsjvVpSG79LBqaCYKB4xsra8w3SQG2HDO7pdRBvEWble VLkgeI/8IYUs8RieyqK0SsKlXwsK3C0CKM+Q0 X-Gm-Gg: ASbGncvkhzqef9ugpQy7lfpYkGVrUPXRC6cmH8ZuOdH9tCNkSQ+trbRgD1cQasUl5pJ KEv6W8qKdRi0JydTwMqq8I3IvYrdqIBeY/a+kz1/vCmn0MM+tPJ3hx/5fP7vvl6Nv4bJ7Pm+2Ef izAI9Zow== X-Google-Smtp-Source: AGHT+IFanYUs+f9FRTrNbv8rCaDu3BbrhEcO46gpBIe7YXsGILx/pIofG6nNH89pRE4DEhDnZC6dlYBFObrvS/Mg5HM= X-Received: by 2002:a05:6214:528f:b0:6e4:2e5f:c03b with SMTP id 6a1803df08f44-6e6b00f47f0mr162702596d6.22.1740418809095; Mon, 24 Feb 2025 09:40:09 -0800 (PST) MIME-Version: 1.0 References: <6bde5f56-9e7a-4148-b81c-eb6532cb3651@eisentraut.org> <9B417838-B872-453D-BBFB-99FA957EB723@yesql.se> <54c008ad-1c23-47d8-ba6c-bed98a39c31c@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> In-Reply-To: <912516.1740329361@sss.pgh.pa.us> From: Jacob Champion Date: Mon, 24 Feb 2025 09:39:57 -0800 X-Gm-Features: AWEUYZllFSb0aSIgOqVYN-WLom6sZD8_ukwu0HO1OhXmrw4rQ5vX4Hf5OASuhAI Message-ID: Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER To: Tom Lane Cc: Daniel Gustafsson , Peter Eisentraut , Antonin Houska , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Feb 23, 2025 at 8:49=E2=80=AFAM Tom Lane wrote: > 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. It's not obvious to me where/how PGoauthBearerRequest > structs are supposed to be constructed, but I find it hard to believe > that they will all spring full-grown from the forehead of Zeus. > Nonetheless, this declaration requires exactly that. As read-only inputs to the client API, they're not meant to be changed for the lifetime of the struct (and the lifetime of the client flow). The only place to initialize such a struct is directly above this code. > (I'm kind of surprised that we're not getting similar bleats from > any buildfarm animals, but so far I don't see any.) Is there a reason for compilers to complain? memcpy's the way I know of to put a const-member struct on the heap, but maybe there are other ways that don't annoy Coverity? If the cost of this warning is too high, removing the const declarations isn't the end of the world. But we use unconstify and other type-punning copies in so many other places that this didn't seem all that bad for the goal of helping out the client writer. > 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. This underscore pattern was copied directly from PQconninfoOption and PQprintOpt. Thanks, --Jacob