Bugzilla – Attachment 190054 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: [24.11.x] Update print format to use built-in formatter
Bug-40524-2411x-Update-print-format-to-use-built-i.patch (text/plain), 2.66 KB, created by
Lucas Gass (lukeg)
on 2025-12-01 15:51:44 UTC
(
hide
)
Description:
Bug 40524: [24.11.x] Update print format to use built-in formatter
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-12-01 15:51:44 UTC
Size:
2.66 KB
patch
obsolete
>From 435f4c70b3ea5ad1d15a2e8992d30df29be9a6ca 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: [24.11.x] 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" > >Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > 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 57a0a00541e..4af6726e48e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -702,6 +702,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); >@@ -741,7 +761,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