Bugzilla – Attachment 152637 Details for
Bug 30524
Add base framework for dealing with CSRF in Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30524: (QA follow-up) Polishing xt script
Bug-30524-QA-follow-up-Polishing-xt-script.patch (text/plain), 1.96 KB, created by
Marcel de Rooy
on 2023-06-23 13:54:58 UTC
(
hide
)
Description:
Bug 30524: (QA follow-up) Polishing xt script
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-06-23 13:54:58 UTC
Size:
1.96 KB
patch
obsolete
>From d19e702530892ad2ec9511c3d410abaf22a43ab6 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 30524: (QA follow-up) Polishing xt script >Content-Type: text/plain; charset=utf-8 > >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 14e1d09f44..15dd6ae626 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.30.2
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 30524
:
133249
|
133250
|
133420
|
138055
|
141297
|
152629
|
152630
|
152631
|
152632
|
152634
|
152635
|
152637
|
152638
|
153964
|
153965
|
153975
|
153976
|
154000
|
154038