Bugzilla – Attachment 184697 Details for
Bug 40524
Stored XSS run by DataTables Print button in staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40524: Update print format to use built-in formatter
Bug-40524-Update-print-format-to-use-built-in-form.patch (text/plain), 2.54 KB, created by
David Cook
on 2025-07-28 03:30:56 UTC
(
hide
)
Description:
Bug 40524: Update print format to use built-in formatter
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-07-28 03:30:56 UTC
Size:
2.54 KB
patch
obsolete
>From 87244ab9bfc351a68238012c9c781e81081df3bc Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 28 Jul 2025 03:26:43 +0000 >Subject: [PATCH] Bug 40524: Update print format to use built-in formatter > >This change updates the print format to use the built-in formatter >for operations like trim, strip HTML, strip newlines, and not >decoding entities. > >Test plan: >0. Apply the patch >1. Go to http://localhost:8081/cgi-bin/koha/acqui/basket.pl?basketno=1 >2. Click "add to basket" >3. Type "test" next to "From an existing record" and click "Submit" >4. On the "Gairm" row, click "Add order" >5. Fill in the required fields >6. In the "Internal note" put the following: >abc123 >7. Click "Save" >8. In the Orders table, click "Export" and then "Print" >9. Note that the print page loads correctly, you can see the internal note, >and you cannot see lines for "Add internal note", >"Edit internal note", or "Add vendor note" >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 22 ++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index bdfe317dda..ec67b6d647 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -816,6 +816,26 @@ function _dt_buttons(params) { > }, > }; > >+ const export_format_print = { >+ body: function (data, row, column, node) { >+ const newnode = node.cloneNode(true); >+ const no_export_nodes = newnode.querySelectorAll(".no-export"); >+ no_export_nodes.forEach(child => { >+ child.parentNode.removeChild(child); >+ }); >+ //Note: innerHTML is the same thing as the data variable, >+ //minus the ".no-export" nodes that we've removed >+ //Note: See dataTables.buttons.js for original function usage >+ const str = DataTable.Buttons.stripData(newnode.innerHTML, { >+ decodeEntities: false, >+ stripHtml: true, >+ stripNewlines: true, >+ trim: true, >+ }); >+ return str; >+ }, >+ }; >+ > var export_format = { > body: function (data, row, column, node) { > var newnode = $(node); >@@ -855,7 +875,7 @@ function _dt_buttons(params) { > extend: "print", > exportOptions: { > columns: exportColumns, >- format: export_format, >+ format: export_format_print, > }, > }, > ]; >-- >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 40524
:
184697
|
187597
|
188757
|
190054
|
190055
|
190056
|
190061