Bug 20770: ILL loans OPAC form notes field allow arbitrary input
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Tue, 15 May 2018 15:00:02 +0000 (16:00 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Thu, 2 Aug 2018 13:22:02 +0000 (10:22 -0300)
This patch addresses the lack of sanitization of the "notes" field on
the OPAC "View Interlibrary loan request" page.

To test:

- Apply the patch
- As an OPAC user, create an ILL request
- Navigate to the request's "View Interlibrary loan request" page
- Add the following note:

  Hello
  <h1>TESTING</h1>
  <script>alert('pwned');</script>

- Click "Submit modifications"
- TEST: Observe, when the page reloads, only the following is preserved in the
"Notes" textarea:

    Hello
    TESTING

- As a staff user, naviate to the ILL requests table
- Select "Manage request" for the request you created
- TEST: Observe that the Notes field only contains:

    Hello
    TESTING

- TEST: Observe that no Javascript alert is displayed

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

koha-tmpl/intranet-tmpl/prog/css/staff-global.css
koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt

index f5ea1af..d05c74b 100644 (file)
@@ -3192,6 +3192,10 @@ fieldset.rows + fieldset.action {
     line-height: 1.3em;
 }
 
+#ill-view-panel .notesopac {
+    display: inline-block;
+}
+
 table#ill-requests {
     width: 100% !important;
 }
index db5b77c..b869b5f 100644 (file)
                                 </li>
                                 <li class="notesopac">
                                     <label for="notesopac" class="notesopac">Opac notes:</label>
-                                    <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac %]</textarea>
+                                    <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
                                 </li>
                             </ol>
                         </fieldset>
                                 </div>
                                 <div class="notesopac">
                                     <span class="label notes_opac">Notes:</span>
-                                    <pre>[% request.notesopac %]</pre>
+                                    <pre>[% request.notesopac | html %]</pre>
                                 </div>
                             </div>
                             <div class="rows">
index 073f8d3..e9632c9 100644 (file)
                                     <li>
                                         <label for="notesopac">Notes:</label>
                                         [% IF !request.completed %]
-                                            <textarea name="notesopac" rows="5" cols="50">[% request.notesopac %]</textarea>
+                                            <textarea name="notesopac" rows="5" cols="50">[% request.notesopac | html %]</textarea>
                                         [% ELSE %]
-                                            [% request.notesopac %]
+                                            [% request.notesopac | html %]
                                         [% END %]
                                     </li>
                                 </ol>