Bugzilla – Attachment 111385 Details for
Bug 26592
XSS vulnerability when ysearch is used
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26592: [19.11] Prevent XSS vulnerabilities when circ/ysearch.pl is used
Bug-26592-1911-Prevent-XSS-vulnerabilities-when-ci.patch (text/plain), 9.65 KB, created by
Jonathan Druart
on 2020-10-09 07:34:36 UTC
(
hide
)
Description:
Bug 26592: [19.11] Prevent XSS vulnerabilities when circ/ysearch.pl is used
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-10-09 07:34:36 UTC
Size:
9.65 KB
patch
obsolete
>From 335c245877f7c65adb423cc2a9fe831f4f576a16 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 1 Oct 2020 11:22:46 +0200 >Subject: [PATCH] Bug 26592: [19.11] Prevent XSS vulnerabilities when > circ/ysearch.pl is used > >--- > .../prog/en/includes/js_includes.inc | 17 ++++++++++++--- > .../prog/en/modules/circ/request-article.tt | 21 +++++++++++++++---- > .../prog/en/modules/course_reserves/course.tt | 20 ++++++++++++++++-- > .../prog/en/modules/reserve/request.tt | 21 +++++++++++++++---- > 4 files changed, 66 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index daf0dc7935..594f322598 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -98,11 +98,11 @@ > var cardnumber = ""; > if( item.cardnumber != "" ){ > // Display card number in parentheses if it exists >- cardnumber = " (" + item.cardnumber + ") "; >+ cardnumber = " (" + ( item.cardnumber ? item.surname.escapeHtml() : "" ) + ") "; > } > return $( "<li></li>" ) > .data( "ui-autocomplete-item", item ) >- .append( "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .append( "<a href=\"" + item.link + "\">" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " + ( item.firstname ? item.firstname.escapeHtml : "" ) + ( cardnumber ? cardnumber.escapeHtml() : "" ) + " <small>" + ( item.dateofbirth ? item.dateofbirth.escapeHtml() : "" ) + " " + ( item.address ? item.address.escapeHtml() : "" ) + " " + ( item.city ? item.city.escapeHtml() : "" ) + " " + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) + " " + ( item.country ? item.country.escapeHtml() : "" ) + "</small></a>" ) > .appendTo( ul ); > }; > } >@@ -130,7 +130,18 @@ > } > return $( "<li></li>" ) > .data( "ui-autocomplete-item", item ) >- .append( "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .append( >+ "<a href=\"" + item.link + "\">" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " >+ + ( item.firstname ? item.firstname.escapeHtml() : "" ) >+ + cardnumber.escapeHtml() >+ + " <small>" >+ + ( item.dateofbirth ? item.dateofbirth.escapeHtml() : "" ) + " " >+ + ( item.address ? item.address.escapeHtml() : "" ) + " " >+ + ( item.city ? item.city.escapeHtml() : "" ) + " " >+ + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) + " " >+ + ( item.country ? item.country.escapeHtml() : "" ) >+ + "</small>" >+ + "</a>" ) > .appendTo( ul ); > }; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >index e2257fc8e5..c65582918c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >@@ -323,10 +323,23 @@ > .data( "ui-autocomplete" )._renderItem = function( ul, item ) { > return $( "<li></li>" ) > .data( "ui-autocomplete-item", item ) >- .append( "<a>" + item.surname + ", " + item.firstname + >- " (" + item.cardnumber + ") <small>" + item.address + >- " " + item.city + " " + item.zipcode + " " + >- item.country + "</small></a>" ) >+ .append( >+ "<a>" >+ + ( item.surname ? item.surname.escapeHtml() : "" ) >+ + ", " >+ + ( item.firstname ? item.firstname.escapeHtml() : "" ) >+ + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")" >+ + " " >+ + "<small>" >+ + ( item.address ? item.address.escapeHtml() : "" ) >+ + " " >+ + ( item.city ? item.city.escapeHtml() : "" ) >+ + " " >+ + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) >+ + " " >+ + ( item.country ? item.country.escapeHtml() : "" ) >+ + "</small>" >+ + "</a>" ) > .appendTo( ul ); > }; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >index a47195d8bf..2111675ee5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >@@ -169,7 +169,23 @@ > .data( "ui-autocomplete" )._renderItem = function( ul, item ) { > return $( "<li></li>" ) > .data( "ui-autocomplete-item", item ) >- .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .append( >+ "<a>" >+ + ( item.surname ? item.surname.escapeHtml() : "" ) >+ + ", " >+ + ( item.firstname ? item.firstname.escapeHtml() : "" ) >+ + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")" >+ + " " >+ + "<small>" >+ + ( item.address ? item.address.escapeHtml() : "" ) >+ + " " >+ + ( item.city ? item.city.escapeHtml() : "" ) >+ + " " >+ + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) >+ + " " >+ + ( item.country ? item.country.escapeHtml() : "" ) >+ + "</small>" >+ + "</a>" ) > .appendTo( ul ); > }; > >@@ -186,7 +202,7 @@ > }); > > function AddInstructor( name, borrowernumber ) { >- div = "<div class='instructor_line' id='borrower_" + borrowernumber + "'>" + name + " ( <a href='#' class='removeInstructor'><i class='fa fa-trash'></i> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + borrowernumber + "' /></div>"; >+ div = "<div class='instructor_line' id='borrower_" + borrowernumber + "'>" + ( name ? name.escapeHtml() : "" ) + " ( <a href='#' class='removeInstructor'><i class='fa fa-trash'></i> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + borrowernumber + "' /></div>"; > $('#instructors').append( div ); > > $('#find_instructor').val('').focus(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index bedf765abe..46cd969899 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1243,10 +1243,23 @@ > .data( "ui-autocomplete" )._renderItem = function( ul, item ) { > return $( "<li></li>" ) > .data( "ui-autocomplete-item", item ) >- .append( "<a>" + item.surname + ", " + item.firstname + >- " (" + item.cardnumber + ") <small>" + item.address + >- " " + item.city + " " + item.zipcode + " " + >- item.country + "</small></a>" ) >+ .append( >+ "<a>" >+ + ( item.surname ? item.surname.escapeHtml() : "" ) >+ + ", " >+ + ( item.firstname ? item.firstname.escapeHtml() : "" ) >+ + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")" >+ + " " >+ + "<small>" >+ + ( item.address ? item.address.escapeHtml() : "" ) >+ + " " >+ + ( item.city ? item.city.escapeHtml() : "" ) >+ + " " >+ + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) >+ + " " >+ + ( item.country ? item.country.escapeHtml() : "" ) >+ + "</small>" >+ + "</a>" ) > .appendTo( ul ); > }; > [% END %] >-- >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 26592
:
111026
|
111075
|
111384
| 111385 |
111386
|
111722
|
111737
|
112595