From eeb6e93b73c3d0ca2a6cd4057b7995f28ed8460b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 May 2024 14:47:30 +0200 Subject: [PATCH] Bug 36863: Deal with non-listed methods in CSRF plack middleware --- Koha/Middleware/CSRF.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Koha/Middleware/CSRF.pm b/Koha/Middleware/CSRF.pm index b34208ec6c4..c73a42e67be 100644 --- a/Koha/Middleware/CSRF.pm +++ b/Koha/Middleware/CSRF.pm @@ -72,6 +72,9 @@ sub call { } } } + elsif ( !exists $stateless_methods{$request_method} && !exists $stateful_methods{$request_method} ) { + $error = sprintf "unknown or unsupported method %s", $request_method; + } #NOTE: It is essential to check for this environmental variable. #NOTE: If we don't check for it, then we'll also throw an error for the "subrequest" that ErrorDocument uses to -- 2.34.1