From eeaa812aa74e91ece7013afa7575e6214d427c5e Mon Sep 17 00:00:00 2001 From: posimai Date: Thu, 26 Mar 2026 14:08:35 +0900 Subject: [PATCH] fix: add esc() and sanitize app.label in innerHTML --- index.html | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 6e0689c..e9c9831 100644 --- a/index.html +++ b/index.html @@ -973,6 +973,11 @@ const CAT_LABELS = { const CAT_ORDER = ['posimai','sns','media','news','tools','nav','shop']; +// ── HTML エスケープ ───────────────────────────────────────── +function esc(s) { + return String(s ?? '').replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,'''); +} + // ── カスタムアプリ ────────────────────────────────────────── function loadCustomApps() { try { @@ -1147,21 +1152,21 @@ function renderApps() { const isInitial = app.icon === '_initial'; const iconHTML = isInitial - ? `
${app.label.charAt(0).toUpperCase()}
` - : ``; + ? `
${esc(app.label).charAt(0).toUpperCase()}
` + : ``; const delBtn = isCustom - ? `` + ? `` : ''; return `
${delBtn} ${iconHTML} - ${app.label} + ${esc(app.label)}