Bugzilla – Attachment 179709 Details for
Bug 38969
Reflected XSS vulnerability in tags
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38969: Prevent JS error when adding tags with quote at the OPAC
Bug-38969-Prevent-JS-error-when-adding-tags-with-q.patch (text/plain), 1.68 KB, created by
David Cook
on 2025-03-25 22:53:11 UTC
(
hide
)
Description:
Bug 38969: Prevent JS error when adding tags with quote at the OPAC
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-03-25 22:53:11 UTC
Size:
1.68 KB
patch
obsolete
>From e3ddad5bbed6db1530a9e8f7d4883e35c881031e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 27 Jan 2025 09:56:30 +0100 >Subject: [PATCH] Bug 38969: Prevent JS error when adding tags with quote at > the OPAC > >Uncaught SyntaxError: missing ) after argument list > >There are way more to fix in this controller... > >Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > opac/opac-tags.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index 7a65538c1b..a1d0627a25 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -202,7 +202,8 @@ if ($is_ajax) { > my $i = 1; > foreach (@errors) { > my $key = ( keys %$_ )[0]; >- $err_string .= "\n\t\t KOHA.Tags.tag_message.$key(\"" . $_->{$key} . '")'; >+ ( my $quote_escaped = $_->{$key} ) =~ s|"|\\"|g; >+ $err_string .= sprintf qq{\n\t\t KOHA.Tags.tag_message.%s("%s")}, $key, $quote_escaped; > if ( $i < scalar @errors ) { $err_string .= ","; } > $i++; > } >@@ -219,7 +220,8 @@ if ($is_ajax) { > foreach ( @{ $bibResult->{errors} } ) { > $js_bibres .= "," if ($i); > my $key = ( keys %$_ )[0]; >- $js_bibres .= "\n\t\t\t KOHA.Tags.tag_message.$key(\"" . $_->{$key} . '")'; >+ ( my $quote_escaped = $_->{$key} ) =~ s|"|\\"|g; >+ $js_bibres .= sprintf qq{\n\t\t\t KOHA.Tags.tag_message.%s("%s")}, $key, $quote_escaped; > $i++; > } > $js_bibres .= "\n\t\t]\n\t}"; >@@ -382,4 +384,3 @@ response = { > }; > > =cut >- >-- >2.39.5
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 38969
:
177148
|
177159
|
177160
|
179553
|
179554
|
179676
|
179708
| 179709 |
179710
|
181329
|
181330
|
181331
|
181332
|
181464