Bugzilla – Attachment 173767 Details for
Bug 37573
Restrict OPACSearchForTitleIn token removal to underscore and alphanumeric
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37573: Fix bad escaping in OPACSearchForTitleIn that broke JavaScript in <script> tags in it
Bug-37573-Fix-bad-escaping-in-OPACSearchForTitleIn.patch (text/plain), 1.63 KB, created by
Magnus Enger
on 2024-10-31 09:14:25 UTC
(
hide
)
Description:
Bug 37573: Fix bad escaping in OPACSearchForTitleIn that broke JavaScript in <script> tags in it
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2024-10-31 09:14:25 UTC
Size:
1.63 KB
patch
obsolete
>From 7ab0c4d0fcf682107f48dd9212450cd0edc8b5fa Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20Kula?= > <148193449+mkibp@users.noreply.github.com> >Date: Tue, 6 Aug 2024 12:45:09 +0000 >Subject: [PATCH] Bug 37573: Fix bad escaping in OPACSearchForTitleIn that > broke JavaScript in <script> tags in it > >The helper Perl function parametrized_url that converted parameters >within {} would actually remove everything between such characters, >regardless of whether they were a correct parameter or any arbitrary >text. > >The patch changes it to remove only something that would look like >a parameter, so that it won't break other unrelated things, while >keeping the original intended behavior. > >Test plan: > >1. Go to settings and in pref OPACSearchForTitleIn enter this: ><script> >function test() { > console.log("test!"); >} >test(); ></script> > >2. Go to OPAC and open some biblio record's page. > >3. Open dev tools console (Ctrl+Shift+I). Before applying the patch >you should see a syntax error, after applying it you should see >"test!" logged. > >Signed-off-by: Magnus Enger <magnus@libriotech.no> >Works as advertised. I added the test plan from Bugzilla to the >commit message above. >--- > C4/Output.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/C4/Output.pm b/C4/Output.pm >index d8ea0bfb52..84a3789ef7 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -408,7 +408,7 @@ sub parametrized_url { > my $val_url = URI::Escape::uri_escape_utf8( $val // q{} ); > $ret =~ s/\{$key\}/$val_url/g; > } >- $ret =~ s/\{[^\{]*\}//g; # remove remaining vars >+ $ret =~ s/\{[A-Z0-9_]+\}//g; # remove remaining vars > return $ret; > } > >-- >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 37573
:
170094
| 173767