Bugzilla – Attachment 59631 Details for
Bug 18010
Remove potential exposure from gettemplate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18010: Unit test for gettemplate
Bug-18010-Unit-test-for-gettemplate.patch (text/plain), 1.59 KB, created by
Marcel de Rooy
on 2017-01-29 15:23:15 UTC
(
hide
)
Description:
Bug 18010: Unit test for gettemplate
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-01-29 15:23:15 UTC
Size:
1.59 KB
patch
obsolete
>From 80278f67eef80faf7f5b6889166ea7723687f1ce Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Sun, 29 Jan 2017 15:52:22 +0100 >Subject: [PATCH] Bug 18010: Unit test for gettemplate >Content-Type: text/plain; charset=utf-8 > >A trivial test, similar to the ones in Auth.t. >Without the check in gettemplate (added in the second patch), the passwd >file will be exposed and the test fails. > >Test plan: >Run t/db_dependent/Templates.t without second patch. The two tests in the >last subtest should fail. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Templates.t | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Templates.t b/t/db_dependent/Templates.t >index 236bd1e..6bea0cd 100755 >--- a/t/db_dependent/Templates.t >+++ b/t/db_dependent/Templates.t >@@ -19,8 +19,9 @@ use Modern::Perl; > > use CGI; > >-use Test::More tests => 5; >+use Test::More tests => 6; > use Test::Deep; >+use Test::Warn; > > BEGIN { > use_ok( 'C4::Templates' ); >@@ -45,5 +46,12 @@ is( scalar @keys, 6, "GetColumnDefs correctly returns the 5 tables defined in co > my @tables = ( 'biblio', 'biblioitems', 'borrowers', 'items', 'statistics', 'subscription'); > cmp_deeply( \@keys, \@tables, "GetColumnDefs returns the expected tables"); > >+subtest 'Testing gettemplate' => sub { >+ plan tests => 2; >+ >+ my $template; >+ warning_like { eval { $template = C4::Templates::gettemplate( '/etc/passwd', 'opac', CGI->new, 1 ) }; warn $@ if $@; } qr/bad template/, 'Bad template check'; >+ is( $template ? $template->output: '', '', 'Check output' ); >+}; > > 1; >-- >2.1.4
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 18010
:
59631
|
59632
|
60418
|
60419
|
61340
|
61341
|
61344
|
61345