Bugzilla – Attachment 92268 Details for
Bug 23329
tracklinks.pl accepts any url from a parameter for proxying if not tracking
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23329: Fix tests
Bug-23329-Fix-tests.patch (text/plain), 2.76 KB, created by
Martin Renvoize (ashimema)
on 2019-08-16 09:24:34 UTC
(
hide
)
Description:
Bug 23329: Fix tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-08-16 09:24:34 UTC
Size:
2.76 KB
patch
obsolete
>From 63b0ba546339d3d9b2f3518cf41bee1df014ae55 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 14 Aug 2019 14:56:48 -0400 >Subject: [PATCH] Bug 23329: Fix tests > >- www.google.com vs https://www.google.com >- Remove transaction otherwise data are not available from webserver >- Use new C4::Output::output_error to avoid 302 (redirect) > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > opac/tracklinks.pl | 3 ++- > t/db_dependent/www/regressions.t | 10 +++------- > 2 files changed, 5 insertions(+), 8 deletions(-) > >diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl >index 26b8a12a87..809037ad4e 100755 >--- a/opac/tracklinks.pl >+++ b/opac/tracklinks.pl >@@ -22,6 +22,7 @@ use Modern::Perl; > use C4::Context; > use C4::Auth qw(checkauth); > use C4::Biblio; >+use C4::Output; > use Koha::Items; > use Koha::Linktracker; > use CGI qw ( -utf8 ); >@@ -78,5 +79,5 @@ if ($uri && ($biblionumber || $itemnumber) ) { > } > } > >-print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); # escape early >+output_error( $cgi, '404' ); > exit; >diff --git a/t/db_dependent/www/regressions.t b/t/db_dependent/www/regressions.t >index 788e1bb13b..4d9a1e06a9 100644 >--- a/t/db_dependent/www/regressions.t >+++ b/t/db_dependent/www/regressions.t >@@ -38,9 +38,7 @@ my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > > subtest 'open redirection vulnerabilities in tracklinks' => sub { >- plan tests => 30; >- >- $schema->storage->txn_begin; >+ plan tests => 36; > > # No URI's > my $biblio = $builder->build_sample_biblio(); >@@ -58,12 +56,12 @@ subtest 'open redirection vulnerabilities in tracklinks' => sub { > $biblio = $builder->build_sample_biblio(); > my $biblionumber3 = $biblio->biblionumber; > $record = $biblio->metadata->record; >- $new856 = MARC::Field->new( '856', '', '', u => "www.google.com" ); >+ $new856 = MARC::Field->new( '856', '', '', u => "http://www.google.com" ); > $record->insert_fields_ordered($new856); > C4::Biblio::ModBiblio( $record, $biblionumber3 ); > > # URI at Item level >- my $item = $builder->build_sample_item( { uri => 'www.google.com' } ); >+ my $item = $builder->build_sample_item( { uri => 'http://www.google.com' } ); > my $itemnumber1 = $item->itemnumber; > > # Incorrect URI at Item level >@@ -132,6 +130,4 @@ subtest 'open redirection vulnerabilities in tracklinks' => sub { > ->status_is( 404, "404 for itemnumber containing different URI" ); > $t->get_ok( $opac . $good_itemnumber ) > ->status_is( 302, "302 for itemnumber with matching URI" ); >- >- $schema->storage->txn_rollback; > }; >-- >2.20.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 23329
:
91566
|
91572
|
91573
|
91759
|
91760
|
92109
|
92110
|
92111
|
92112
|
92187
|
92188
|
92198
|
92199
|
92200
|
92212
|
92213
|
92214
|
92215
|
92216
|
92217
|
92218
|
92219
|
92220
|
92223
|
92224
|
92225
|
92226
|
92227
|
92228
|
92229
|
92230
|
92231
|
92262
|
92263
|
92264
|
92265
|
92266
|
92267
| 92268 |
92269