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... Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
6adf1c1cc1
commit
a019e78f4b
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue