From 7c58c8183e8a14c4bd8c6e036dc4ecb472d2e0d9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 3 Apr 2026 09:45:56 +0200 Subject: [PATCH] Bug 42253: Prevent XSS in the advanced editor - macros Test plan: /cgi-bin/koha/cataloguing/editor.pl Click "Macros", "New macro..." Enter OK Click on the macro name, run macro, delete macro, mark as public: Nothing should trigger an alert QA: - $( '#macro-list li[data-name="' + name + '"][data-id="' + id + '"]' ).addClass( 'active' ); + $( '#macro-list li[data-id="' + id + '"]' ).addClass( 'active' ); Why did we need name and id to select the macro? Signed-off-by: Phil Ringnalda Signed-off-by: David Cook Signed-off-by: Jacob O'Mara --- koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index 3ba6d17293..de40ef631b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -773,7 +773,7 @@ macroEditor.setValue( '' ); return; } - $( '#macro-list li[data-name="' + name + '"][data-id="' + id + '"]' ).addClass( 'active' ); + $( '#macro-list li[data-id="' + id + '"]' ).addClass( 'active' ); api_url = "/api/v1/advanced_editor/macros/"; if( shared ) { api_url += "shared/" } let options = { @@ -878,7 +878,7 @@ $.ajax(options) .then(function(result) { $.each(result,function( undef, macro ){ - var $li = $( '
  • ' + macro.name + '
    1. ' ); + var $li = $( '
    2. ' + escape_str(macro.name) + '
      1. ' ); if ( macro.macro_id == macroEditor.activeMacroId ) $li.addClass( 'active' ); $li.click( function() { loadMacro(macro.name, macro.macro_id, macro.shared);