From b92489038193bf17169070ed1ca0f33c8239d0ae Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 29 Jul 2024 03:53:06 +0000 Subject: [PATCH] Bug 37508: Throw error if password column is detected in SQL report TESTS TO COME --- C4/Reports/Guided.pm | 6 ++++++ .../prog/en/modules/reports/guided_reports_start.tt | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index f69804c2838..586c979b343 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -622,6 +622,12 @@ sub execute_query { Koha::Logger->get( { prefix => 0, interface => 'reports', category => 'execute.time.end' } ) ->info("Report finished: $report_id") if $report_id; + foreach my $header ( @{ $sth->{NAME} } ) { + if ( $header eq 'password' ) { + return ( $sth, { passworderr => $header } ); + } + } + return ( $sth, { queryerr => $sth->errstr } ) if ( $sth->err ); return ($sth); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index b039bd5cf95..44c9cf766b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -1436,6 +1436,10 @@ [% error.queryerr | html %]
Please check the log for further details. [% ELSIF ( error.cache_expiry ) %] Please select a cache expiry less than 30 days. + [% ELSIF ( error.passworderr ) %] + The column selection in this report includes a password field.
+ The report cannot be executed due to security risks.
+ Please edit this report and ensure no password columns have been selected. [% ELSE %] [% END %]
-- 2.39.2