Bugzilla – Attachment 163417 Details for
Bug 24879
Add missing authentication checks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24879: Add new test to catch missing auth statement
Bug-24879-Add-new-test-to-catch-missing-auth-state.patch (text/plain), 2.66 KB, created by
Martin Renvoize (ashimema)
on 2024-03-19 11:49:35 UTC
(
hide
)
Description:
Bug 24879: Add new test to catch missing auth statement
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-03-19 11:49:35 UTC
Size:
2.66 KB
patch
obsolete
>From cd3b731ee4462318349abcf2e3e99a255c411b14 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 17 Mar 2020 11:54:12 +0100 >Subject: [PATCH] Bug 24879: Add new test to catch missing auth statement > >in intranet scripts > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > xt/find-missing-auth_checks.t | 72 +++++++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > create mode 100755 xt/find-missing-auth_checks.t > >diff --git a/xt/find-missing-auth_checks.t b/xt/find-missing-auth_checks.t >new file mode 100755 >index 00000000000..bc9af3a6c27 >--- /dev/null >+++ b/xt/find-missing-auth_checks.t >@@ -0,0 +1,72 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Test::More; >+ >+use File::Spec; >+use File::Find; >+ >+my @files; >+sub wanted { >+ my $name = $File::Find::name; >+ push @files, $name >+ if $name =~ m{^\./( >+ acqui >+ |admin >+ |authorities >+ |basket >+ |catalogue >+ |cataloguing >+ |circ >+ |clubs >+ |course_reserves >+ |installer >+ |labels >+ |members >+ |patroncards >+ |pos >+ |reports >+ |reserve >+ |reviews >+ |rotating_collections >+ |serials >+ |services >+ |suggestion >+ |svc >+ |tags >+ |tools >+ |virtualshelves >+ )}xms >+ && $name =~ m{\.(pl)$} >+ && -f $name; >+} >+ >+find({ wanted => \&wanted, no_chdir => 1 }, File::Spec->curdir()); >+ >+my @missing_auth_check; >+FILE: foreach my $name (@files) { >+ open( FILE, $name ) || die "cannot open file $name $!"; >+ while ( my $line = <FILE> ) { >+ for my $routine ( qw( get_template_and_user check_cookie_auth checkauth check_api_auth ) ) { >+ next FILE if $line =~ m|^[^#]*$routine|; >+ } >+ } >+ push @missing_auth_check, $name; >+} >+is( scalar @missing_auth_check, 0 ) or diag "No auth check in the following files:\n" . join "\n", @missing_auth_check; >+done_testing; >-- >2.44.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 24879
:
100885
|
106978
|
163139
|
163140
|
163141
|
163142
|
163143
|
163183
| 163417 |
163418
|
163419
|
163420
|
163421
|
163422
|
163977