Bugzilla – Attachment 153941 Details for
Bug 34426
Add tests for CSRF checks missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34426: (QA follow-up) Polishing xt script
Bug-34426-QA-follow-up-Polishing-xt-script.patch (text/plain), 1.92 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-07-26 21:04:54 UTC
(
hide
)
Description:
Bug 34426: (QA follow-up) Polishing xt script
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-07-26 21:04:54 UTC
Size:
1.92 KB
patch
obsolete
>From 3783dd2bcea4d24ade2e1b787acdfb5315024b92 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 23 Jun 2023 09:56:40 +0000 >Subject: [PATCH] Bug 34426: (QA follow-up) Polishing xt script > >Test plan: >Run it again. Same results? > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > xt/find-missing-csrf.t | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > >diff --git a/xt/find-missing-csrf.t b/xt/find-missing-csrf.t >index 14e1d09f44c..15dd6ae6265 100755 >--- a/xt/find-missing-csrf.t >+++ b/xt/find-missing-csrf.t >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Copyright 2021 Koha development team >+# > # This file is part of Koha. > # > # Koha is free software; you can redistribute it and/or modify it >@@ -63,19 +65,17 @@ sub check_csrf_in_forms { > my @lines = read_file($file); > my @errors; > return @errors unless grep { $_ =~ m|<form| } @lines; >- my ( $open, $found, $closed ) = ( 0, 0, 0 ); >+ my ( $open, $found ) = ( 0, 0 ); > my $line = 0 ; > for my $l (@lines) { > $line++; >- $open = $line if ( $l =~ m{<form} && !($l =~ m{method=('|")get('|")})); >- $found++ if ($l =~ m|csrf\-token\.inc| && $open); >- $closed++ if ($l =~ m|</form| && $open); >- if ( $open && $closed ) { >- push @errors, "The <form> starting on line $open is missing it's corresponding csrf_token include (see bug 22990)" >- if !$found; >- >- # reset >- ( $open, $found, $closed ) = ( 0, 0, 0 ); >+ $open = $line if ( $l =~ m{<form} && !( $l =~ m{method=('|")get('|")} ) ); >+ $found++ if ( $l =~ m|csrf\-token\.inc| && $open ); >+ if ( $open && $l =~ m|</form| ) { >+ push @errors, >+ "The <form> starting on line $open is missing it's corresponding csrf_token include (see bug 22990)" >+ if !$found; >+ $found = 0; > } > } > return @errors; >-- >2.41.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 34426
:
153940
| 153941