From 0396c39b775b0352c53ba636dba367dfc38b4210 Mon Sep 17 00:00:00 2001 From: malonehunter Date: Mon, 14 Sep 2026 05:49:52 -0400 Subject: [PATCH] calc: escape cipher names at all render sinks (parity with production; interim, CSP-real is the durable fix) Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01LmGTn96JVn6xPNNTTW77g1 --- calc/breakdown.js | 12 ++++++------ calc/calc.js | 12 ++++++------ calc/database.js | 2 +- calc/encoding.js | 2 +- index.html | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/calc/breakdown.js b/calc/breakdown.js index d8d9567..dd63e30 100644 --- a/calc/breakdown.js +++ b/calc/breakdown.js @@ -82,7 +82,7 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd = } oStart += '
' oStart += '' + escHtml(simplePhr) + ' = ' + curCipher.sumArr.reduce(getSum) + ' ' // add all values in array - oStart += ' (' + curCipher.cipherName + gemCalcModeLabel(curCipher) + ')' + oStart += ' (' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + ')' } if (optWordBreakdown == true && curCipher.cp.length <= chLimit ) { // character limit, calculated even if out of screen bounds @@ -141,7 +141,7 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd = } } ciphEndClass = (leftToRightBreak) ? "CipherEnd" : "CipherEndRTL" - if (optCompactBreakdown == true) o += '' + curCipher.cipherName + gemCalcModeLabel(curCipher) + '
' + if (optCompactBreakdown == true) o += '' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + '' else o += '' o = oStart + o // prepend phrase, word/letter count @@ -227,7 +227,7 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd = o = oStart + o // prepend phrase, word/letter count if (optCompactBreakdown == true) { o += '
' + curCipher.sumArr.reduce(getSum) + ' ' - o += '' + curCipher.cipherName + gemCalcModeLabel(curCipher) + '
' + o += '' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + '' } else { o += '
' } @@ -249,7 +249,7 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd = if (curCipher.cp.length > chLimit) chartClass = 'SimpleBreakChartLong' o = '' o += '
' + escHtml(simplePhr) + ' = ' + curCipher.sumArr.reduce(getSum) + ' ' // add all values in array - o += '(' + curCipher.cipherName + gemCalcModeLabel(curCipher) + ')
' + o += '(' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + ')' $('#BreakTableContainer').prepend(o) // insert in the beginning of the table } @@ -322,7 +322,7 @@ function updateCipherChart(curCipher) { o += '' o += '-' // Space o += '' - o += '' + curCipher.cipherName + '' + o += '' + escHtml(curCipher.cipherName) + '' o += '' o += '←' // Backspace o += '' @@ -376,7 +376,7 @@ function updateCipherChartGemCard(impName = breakCipher) { o += '' o += '' - o += '' + curCipher.cipherName + '' + o += '' + escHtml(curCipher.cipherName) + '' o += '' var halfL = curCipher.cArr.length / 2 diff --git a/calc/calc.js b/calc/calc.js index a6d2092..f58e9e8 100644 --- a/calc/calc.js +++ b/calc/calc.js @@ -443,7 +443,7 @@ function displayCipherCatDetailed(curCat) { } // checkbox state o += '