all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Cc: Thomas Skinner <thomas@atskinner.net>
Subject: Re: [pve-devel] [PATCH openid 1/1] fix #4234: openid: make userinfo request optional
Date: Wed, 13 Nov 2024 13:11:28 +0100	[thread overview]
Message-ID: <1731499744.o69e60gkqk.astroid@yuna.none> (raw)
In-Reply-To: <20240830223430.237913-2-thomas@atskinner.net>

On August 31, 2024 12:34 am, Thomas Skinner wrote:
> Signed-off-by: Thomas Skinner <thomas@atskinner.net>
> ---
>  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<GenericUserInfoClaims>), 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<GenericUserInfoClaims> = 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


  reply	other threads:[~2024-11-13 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30 22:34 [pve-devel] [PATCH openid 0/1] Make OIDC userinfo endpoint optional Thomas Skinner
2024-08-30 22:34 ` [pve-devel] [PATCH openid 1/1] fix #4234: openid: make userinfo request optional Thomas Skinner
2024-11-13 12:11   ` Fabian Grünbichler [this message]
2024-10-03  1:46 ` [pve-devel] [PATCH openid 0/1] Make OIDC userinfo endpoint optional Thomas Skinner
2024-11-13 12:55 ` Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1731499744.o69e60gkqk.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=thomas@atskinner.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal