all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Folke Gleumes <f.gleumes@proxmox.com>
Subject: Re: [pve-devel] [PATCH acme 1/5] fix #4497: add support for external account bindings
Date: Tue, 24 Oct 2023 11:07:14 +0200	[thread overview]
Message-ID: <a80468f1-fade-46df-bec6-f2f8882a1c05@proxmox.com> (raw)
In-Reply-To: <20231023131808.172494-2-f.gleumes@proxmox.com>

mostly stylistic nits inline, but also a comment w.r.t. FWICT needles ABI
breakage.

Am 23/10/2023 um 15:18 schrieb Folke Gleumes:
> implementation acording to rfc855 section 7.3.4

s/acording/according/

> 
> Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
> ---
>  src/PVE/ACME.pm | 43 +++++++++++++++++++++++++++++++++++--------
>  1 file changed, 35 insertions(+), 8 deletions(-)
> 

> @@ -251,6 +251,28 @@ sub jws {
>      };
>  }
>  
> +# EAB signing using the HS256 alg (HMAC/SHA256).

At least write out the acronym "external account binding" out once here,
or maybe expand the method name "external_account_binding", for clarity.

> +sub eab {
> +    my ($self, $eab_kid, $eab_hmac_key, $url) = @_;
> +

> @@ -329,21 +351,26 @@ sub __new_account {
>      return $self->{account};
>  }
>  
> -# Create a new account using data in %info.
> +# Create a new account using data in $info.
>  # Optionally pass $tos_url to agree to the given Terms of Service
>  # POST to newAccount endpoint
>  # Expects a '201 Created' reply
>  # Saves and returns the account data
>  sub new_account {
> -    my ($self, $tos_url, %info) = @_;
> +    my ($self, $tos_url, $info) = @_;

This needlessly breaks older call sites though? Why not keep the plain hash
here, you do not really win anything by switching to a hash ref, or?

Let's avoid churn w.r.t. breaking older package dependencies, if not really
required..

>      my $url = $self->_method('newAccount');
>  
> +    if ($info->{'eab'}) {

nit: eab doesn't need quoting

And if you keep the method signature to accept a hash (not a hash reference)
here you could do something like:

if (my $eab = $info{eab}) {
    my $eab_hmac_key = decode_base64($eab->{hmac_key});
    # ..
}

> +	my $eab_hmac_key = decode_base64($info->{'eab'}->{hmac_key});

nit: inconsistent hash key quoting in the same statement

> +	$info->{externalAccountBinding} = $self->eab($info->{'eab'}->{kid}, $eab_hmac_key, $url);
> +    }
> +
>      if ($tos_url) {
>  	$self->{tos} = $tos_url;
> -	$info{termsOfServiceAgreed} = JSON::true;> +	$info->{termsOfServiceAgreed} = JSON::true;

can be avoided by keeping the hash

>      }
>  
> -    return $self->__new_account(201, $url, 1, %info);
> +    return $self->__new_account(201, $url, 1, %{$info});

like above, can be avoided

>  }
>  
>  # Update existing account with new %info





  parent reply	other threads:[~2023-10-24  9:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 13:18 [pve-devel] [PATCH acme/manager 0/5] fix #4497: add external account binding support Folke Gleumes
2023-10-23 13:18 ` [pve-devel] [PATCH acme 1/5] fix #4497: add support for external account bindings Folke Gleumes
2023-10-24  8:32   ` Fabian Grünbichler
2023-10-27  6:40     ` Thomas Lamprecht
2023-10-24  9:07   ` Thomas Lamprecht [this message]
2023-10-23 13:18 ` [pve-devel] [PATCH manager 2/5] fix #4497: acme: " Folke Gleumes
2023-10-24  8:32   ` Fabian Grünbichler
2023-10-23 13:18 ` [pve-devel] [PATCH manager 3/5] fix #4497: api/acme: deprecate tos endpoint in favor of meta Folke Gleumes
2023-10-24  8:32   ` Fabian Grünbichler
2023-10-23 13:18 ` [pve-devel] [PATCH manager 4/5] fix #4497: cli/acme: detect eab and ask for credentials Folke Gleumes
2023-10-24  8:32   ` Fabian Grünbichler
2023-10-23 13:18 ` [pve-devel] [PATCH manager 5/5] fix #4497: ui/acme: switch to new meta endpoint Folke Gleumes
2023-10-24  8:32 ` [pve-devel] [PATCH acme/manager 0/5] fix #4497: add external account binding support 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=a80468f1-fade-46df-bec6-f2f8882a1c05@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=f.gleumes@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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