[pve-devel] [PATCH pve-common] ticket: remove fallback for SHA1-base64 CSRF prevention tokens

Max Carrara m.carrara at proxmox.com
Tue Feb 20 16:08:36 CET 2024


Signed-off-by: Max Carrara <m.carrara at 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





More information about the pve-devel mailing list