mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-27 00:16:44 +00:00
fix: escape folder names in Dashboard nav-history menu (stored XSS)
The back/forward taphold menus interpolated path.basename(history_item) straight into UIContextMenu item html, which renders it verbatim. A folder named with an HTML/script payload executed when the user opened the history menu after visiting it. The desktop file manager already encodes this value; match it with html_encode(). Verified live: the payload now renders as inert text and its onerror never fires.
This commit is contained in:
@@ -1046,7 +1046,7 @@ const TabFiles = {
|
||||
const history_item = window.dashboard_nav_history[index];
|
||||
|
||||
items.push({
|
||||
html: `<span>${history_item === window.home_path ? i18n('home') : path.basename(history_item)}</span>`,
|
||||
html: `<span>${history_item === window.home_path ? i18n('home') : html_encode(path.basename(history_item))}</span>`,
|
||||
val: index,
|
||||
onClick: function (e) {
|
||||
window.dashboard_nav_history_current_position = e.value;
|
||||
@@ -1087,7 +1087,7 @@ const TabFiles = {
|
||||
const history_item = window.dashboard_nav_history[index];
|
||||
|
||||
items.push({
|
||||
html: `<span>${history_item === window.home_path ? i18n('home') : path.basename(history_item)}</span>`,
|
||||
html: `<span>${history_item === window.home_path ? i18n('home') : html_encode(path.basename(history_item))}</span>`,
|
||||
val: index,
|
||||
onClick: function (e) {
|
||||
window.dashboard_nav_history_current_position = e.value;
|
||||
|
||||
Reference in New Issue
Block a user