From a2c7cc65c9077d1deaaaf957c05b1b9d2f7db8f9 Mon Sep 17 00:00:00 2001 From: Zhihao Ma Date: Tue, 17 Dec 2024 17:13:30 -0500 Subject: [PATCH] adds length check for opaque key --- .../lib/pfappserver/Form/Config/Radiusd/TeapProfile.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/pfappserver/lib/pfappserver/Form/Config/Radiusd/TeapProfile.pm b/html/pfappserver/lib/pfappserver/Form/Config/Radiusd/TeapProfile.pm index d997db75cb41..4e987eed3bf5 100644 --- a/html/pfappserver/lib/pfappserver/Form/Config/Radiusd/TeapProfile.pm +++ b/html/pfappserver/lib/pfappserver/Form/Config/Radiusd/TeapProfile.pm @@ -40,10 +40,10 @@ has_field 'pac_opaque_key' => ( type => 'Text', apply => [ { - check => sub { $_[0] =~ /^[0-9a-fA-F]+$/ }, + check => sub { $_[0] =~ /^[0-9a-fA-F]{32}$/ }, message => sub { my ( $value, $field ) = @_; - return $field->name . " must be hexadecimal"; + return $field->name . " must be 32-chars hexadecimal. e.g., openssl rand -hex 32"; }, } ]