Bugzilla – Attachment 179554 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.62 KB, created by
Baptiste Wojtkowski (bwoj)
on 2025-03-20 15:55:29 UTC
(
hide
)
Description:
Bug 38969: Prevent JS error when adding tags with quote at the OPAC
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2025-03-20 15:55:29 UTC
Size:
1.62 KB
patch
obsolete
>From 795dc3ffd91c3f33c302a7ba2666711cc5c0e9db 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> >--- > 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 7a65538c..a1d0627a 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.30.2
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