Bugzilla – Attachment 163143 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: Use perl shebang to list the exec
Bug-24879-Use-perl-shebang-to-list-the-exec.patch (text/plain), 2.48 KB, created by
Jonathan Druart
on 2024-03-14 15:54:06 UTC
(
hide
)
Description:
Bug 24879: Use perl shebang to list the exec
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-03-14 15:54:06 UTC
Size:
2.48 KB
patch
obsolete
>From cd791839bebb66ddc1dff56bb143e27b47fd6989 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 14 Mar 2024 16:53:35 +0100 >Subject: [PATCH] Bug 24879: Use perl shebang to list the exec > >--- > xt/find-missing-auth_checks.t | 50 +++++++---------------------------- > 1 file changed, 10 insertions(+), 40 deletions(-) > >diff --git a/xt/find-missing-auth_checks.t b/xt/find-missing-auth_checks.t >index 77909bd5c92..d86fab2917b 100755 >--- a/xt/find-missing-auth_checks.t >+++ b/xt/find-missing-auth_checks.t >@@ -18,54 +18,24 @@ > use Modern::Perl; > use Test::More; > >-use File::Spec; >-use File::Find; >+use File::Slurp qw(read_file); > >-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 >- |labels >- |members >- |patroncards >- |pos >- |reports >- |reserve >- |reviews >- |rotating_collections >- |serials >- |services >- |suggestion >- |svc >- |tags >- |tools >- |virtualshelves >- )}xms >- && $name =~ m{\.(pl)$} >- && -f $name; >-} >+my @excluded_paths = qw(C4 debian docs etc installer/data install_misc Koha misc selenium t test tmp xt changelanguage.pl build-resources.PL fix-perl-path.PL ); >+push @excluded_paths, 'opac'; # We cannot test the OPAC scripts, some can be accessed without authentication > >-find({ wanted => \&wanted, no_chdir => 1 }, File::Spec->curdir()); >+my $grep_cmd = q{git grep -l '#!/usr/bin/perl' -- } . join( ' ', map { qq{':!$_'} } @excluded_paths ); >+my @files = `$grep_cmd`; > > my @missing_auth_check; >-FILE: foreach my $name (@files) { >- open( FILE, $name ) || die "cannot open file $name $!"; >- while ( my $line = <FILE> ) { >+FILE: foreach my $file (@files) { >+ chomp $file; >+ my @lines = read_file($file); >+ for my $line ( @lines ) { > for my $routine ( qw( get_template_and_user check_cookie_auth checkauth check_api_auth C4::Service->init ) ) { > next FILE if $line =~ m|^[^#]*$routine|; > } > } >- push @missing_auth_check, $name; >+ push @missing_auth_check, $file; > } > is( scalar @missing_auth_check, 0 ) or diag "No auth check in the following files:\n" . join "\n", @missing_auth_check; > done_testing; >-- >2.34.1
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