From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id A540B1FF0AA for ; Tue, 17 Nov 2026 14:30:19 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id C2CBA216AC; Tue, 17 Nov 2026 14:30:08 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 17 Nov 2026 14:29:58 +0100 Message-Id: Subject: Re: [PATCH v2 proxmox 19/19] access-control: allow extending tokens on secret regeneration To: "Thomas Lamprecht" , X-Mailer: aerc 0.20.0 References: <20261115194043.3947825-1-t.lamprecht@proxmox.com> <20261115194043.3947825-20-t.lamprecht@proxmox.com> In-Reply-To: <20261115194043.3947825-20-t.lamprecht@proxmox.com> From: "Shannon Sterz" X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794922198586 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.587 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 2XVVSJGAJUJLWV7D2ANG5MWRGTFLC55D X-Message-ID-Hash: 2XVVSJGAJUJLWV7D2ANG5MWRGTFLC55D X-MailFrom: s.sterz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Sun Nov 15, 2026 at 8:40 PM CET, Thomas Lamprecht wrote: > Counterpart of the new 'allow-extension-on-regenerate' token policy > setting in PVE: with it, an update that regenerates the secret may > also extend the expiration date despite 'disallow-expiry-extension', > as the old credential stops working just like it would on recreating > the token. The maximum lifetime still bounds the new date, and the > check still runs before the secret is regenerated. > > Suggested-by: Shannon Sterz > Signed-off-by: Thomas Lamprecht > --- > > new in v2 > > proxmox-access-control/src/api/tokens.rs | 8 +++- > proxmox-access-control/src/types.rs | 56 ++++++++++++++++++++++-- > 2 files changed, 59 insertions(+), 5 deletions(-) > > diff --git a/proxmox-access-control/src/api/tokens.rs b/proxmox-access-co= ntrol/src/api/tokens.rs > index 0ddcfdd3..0c4d408f 100644 > --- a/proxmox-access-control/src/api/tokens.rs > +++ b/proxmox-access-control/src/api/tokens.rs > @@ -220,8 +220,12 @@ pub fn update_token( > > if let Some(expire) =3D expire { > if let Some(policy) =3D crate::init::access_conf().token_policy(= )? { > - let current =3D data.expire.unwrap_or(0); > - policy.check_expiry_update(expire, current, proxmox_time::ep= och_i64())?; > + policy.check_expiry_update( > + expire, > + data.expire.unwrap_or(0), > + regenerate =3D=3D Some(true), nit: an `unwrap_or_default()` would have the same effect and may be considered more idiomatic -->8 snip 8<--