public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Max Carrara <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-common] ticket: remove fallback for SHA1-base64 CSRF prevention tokens
Date: Tue, 20 Feb 2024 16:08:36 +0100	[thread overview]
Message-ID: <20240220150836.520529-1-m.carrara@proxmox.com> (raw)

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
---
As the old inline comment notes, this should've been removed in
PVE 7.0 already.

 src/PVE/Ticket.pm | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/PVE/Ticket.pm b/src/PVE/Ticket.pm
index ce8d5c8..c5508ed 100644
--- a/src/PVE/Ticket.pm
+++ b/src/PVE/Ticket.pm
@@ -34,13 +34,7 @@ sub verify_csrf_prevention_token {
 	my $timestamp = $1;
 	my $ttime = hex($timestamp);
 
-	my $digest;
-	if (length($sig) == 27) {
-	    # detected sha1 csrf token from older proxy, fallback. FIXME: remove with 7.0
-	    $digest = Digest::SHA::sha1_base64("$timestamp:$username", $secret);
-	} else {
-	    $digest = Digest::SHA::hmac_sha256_base64("$timestamp:$username", $secret);
-	}
+	my $digest = Digest::SHA::hmac_sha256_base64("$timestamp:$username", $secret);
 
 	my $age = time() - $ttime;
 	return 1 if ($digest eq $sig) && ($age > $min_age) &&
-- 
2.39.2





             reply	other threads:[~2024-02-20 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 15:08 Max Carrara [this message]
2024-03-06 11:10 ` [pve-devel] applied: " Wolfgang Bumiller

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=20240220150836.520529-1-m.carrara@proxmox.com \
    --to=m.carrara@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal