Bugzilla – Attachment 177160 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.49 KB, created by
Jonathan Druart
on 2025-01-27 08:58:00 UTC
(
hide
)
Description:
Bug 38969: Prevent JS error when adding tags with quote at the OPAC
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-01-27 08:58:00 UTC
Size:
1.49 KB
patch
obsolete
>From 6410c0595537af17e9ef7ddeef068d17ff9088e1 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... >--- > opac/opac-tags.pl | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index e9333dee161..e71dc475a05 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -200,7 +200,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++; > } >@@ -216,8 +217,9 @@ if ($is_ajax) { > my $i = 0; > foreach (@{$bibResult->{errors}}) { > $js_bibres .= "," if ($i); >- my $key = (keys %$_)[0]; >- $js_bibres .= "\n\t\t\t KOHA.Tags.tag_message.$key(\"" . $_->{$key} . '")'; >+ my $key = (keys %$_)[0]; >+ ( 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}"; >-- >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 38969
:
177148
|
177159
|
177160
|
179553
|
179554
|
179676
|
179708
|
179709
|
179710
|
181329
|
181330
|
181331
|
181332
|
181464