Bugzilla – Attachment 192944 Details for
Bug 41812
xt/find-missing-csrf.t failing when JS contains csrf_token hidden input
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41812: Adjust find-missing-csrf.t test to ignore csrf input from JS
62d325e.patch (text/plain), 1.42 KB, created by
Jonathan Druart
on 2026-02-10 20:18:40 UTC
(
hide
)
Description:
Bug 41812: Adjust find-missing-csrf.t test to ignore csrf input from JS
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2026-02-10 20:18:40 UTC
Size:
1.42 KB
patch
obsolete
>From 62d325e986e8b715cb1a75262d1e0d622581d2fc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 10 Feb 2026 21:14:57 +0100 >Subject: [PATCH] Bug 41812: Adjust find-missing-csrf.t test to ignore csrf > input from JS > >This code injected the csrf token using the TT include file, that made >pass xt/find-missing-csrf.t > >This bug removed the TT tags from the script tags, and we now need to >use a JS variable and retrieve the csrf token from the meta tag. > >This patch suggests to adjust the script to ignore this case. We could >also rewrite the whole JS code and use built the HTML elements using >vanilla JS but that's for another day... >--- > xt/find-missing-csrf.t | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/xt/find-missing-csrf.t b/xt/find-missing-csrf.t >index dd229e6eed9..5e08fce88d1 100755 >--- a/xt/find-missing-csrf.t >+++ b/xt/find-missing-csrf.t >@@ -50,7 +50,9 @@ sub check_csrf_in_forms { > for my $line (@lines) { > $line_number++; > $open = $line_number if $line =~ m{<form.*method=('|")post('|")}i; >- $found++ if $open && $line =~ m{csrf-token\.inc}; >+ $found++ >+ if $open && $line =~ m{csrf-token\.inc} >+ || $line =~ m{<input type="hidden" name="csrf_token" value="\$\{csrf_token\}" />}; > if ( $open && $line =~ m{</form} ) { > push @errors, $open unless $found; > $found = 0; >-- >2.43.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41812
:
192944
|
192945
|
192946