From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 181141FF15C for ; Wed, 13 Nov 2024 13:12:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 943B614A44; Wed, 13 Nov 2024 13:12:04 +0100 (CET) Date: Wed, 13 Nov 2024 13:11:28 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20240830223430.237913-1-thomas@atskinner.net> <20240830223430.237913-2-thomas@atskinner.net> In-Reply-To: <20240830223430.237913-2-thomas@atskinner.net> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1731499744.o69e60gkqk.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH openid 1/1] fix #4234: openid: make userinfo request optional X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: Thomas Skinner Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On August 31, 2024 12:34 am, Thomas Skinner wrote: > Signed-off-by: Thomas Skinner > --- > proxmox-openid/src/lib.rs | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/proxmox-openid/src/lib.rs b/proxmox-openid/src/lib.rs > index fe65fded..7cef06e0 100644 > --- a/proxmox-openid/src/lib.rs > +++ b/proxmox-openid/src/lib.rs > @@ -195,7 +195,7 @@ impl OpenIdAuthenticator { > &self, > code: &str, > private_auth_state: &PrivateAuthState, > - ) -> Result<(CoreIdTokenClaims, GenericUserInfoClaims), Error> { > + ) -> Result<(CoreIdTokenClaims, Option), Error> { this is a breaking change anyway (even though it is masked by verify_authentication_code_simple ;)) > let code = AuthorizationCode::new(code.to_string()); > // Exchange the code with a token. > let token_response = self > @@ -213,11 +213,14 @@ impl OpenIdAuthenticator { > .claims(&id_token_verifier, &private_auth_state.nonce) > .map_err(|err| format_err!("Failed to verify ID token: {}", err))?; > > - let userinfo_claims: GenericUserInfoClaims = self > + let userinfo_claims: Option = match self > .client > .user_info(token_response.access_token().to_owned(), None)? > .request(http_client) > - .map_err(|err| format_err!("Failed to contact userinfo endpoint: {}", err))?; > + { > + Ok(claims) => Some(claims), > + Err(..) => None, and like you said in the cover letter, this would hide errors.. I think it would be better to extend this (and the simple variant) with a boolean parameter that decides whether to query the user_info at all - if it is set, then failure to do so should still be a hard error.. and then calling sites can decide where/how to store this configuration knob and whether to expose it.. > + }; > > Ok((id_token_claims.clone(), userinfo_claims)) > } > -- > 2.39.2 > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel