calc: cipher/option import parsed, never eval'd (parseCipherArgs/cipherFromExport; option names whitelisted, values JSON scalars); manifest icons point at files that exist (36→32)
Removes the five eval() sites: imported cipher files and the localStorage settings copy can no longer execute code, and the calculator now works under a CSP without 'unsafe-eval'. Export format unchanged for booleans/numbers. Parity commit with the instance tree; release gated.
This commit is contained in:
1 parent
a88532f421
commit
777089b91d
6 files changed
+94
-51
No files matched your search
+37
-36
@@ -92,45 +92,46 @@ var coderainLitDefault = 0.19;
|
||||
var optImageScale = 1.0; // image scaling factor for screenshots
|
||||
|
||||
var calcOptionsArr = [
|
||||
// used to export/import settings
|
||||
"'optNumCalcMethod'+' = '+optNumCalcMethod",
|
||||
"'optFiltCrossCipherMatch'+' = '+optFiltCrossCipherMatch",
|
||||
"'optFiltSameCipherMatch'+' = '+optFiltSameCipherMatch",
|
||||
"'optHltSameCipher'+' = '+optHltSameCipher",
|
||||
"'optShowOnlyMatching'+' = '+optShowOnlyMatching",
|
||||
"'autoMatchEnabled'+' = '+autoMatchEnabled",
|
||||
"'optNewPhrasesGoFirst'+' = '+optNewPhrasesGoFirst",
|
||||
"'optShowExtraCiphers'+' = '+optShowExtraCiphers",
|
||||
"'optAllowPhraseComments'+' = '+optAllowPhraseComments",
|
||||
"'liveDatabaseMode'+' = '+liveDatabaseMode",
|
||||
"'optLetterWordCount'+' = '+optLetterWordCount",
|
||||
"'optWordBreakdown'+' = '+optWordBreakdown",
|
||||
"'optCompactBreakdown'+' = '+optCompactBreakdown",
|
||||
"'optShowCipherChart'+' = '+optShowCipherChart",
|
||||
"'optGradientCharts'+' = '+optGradientCharts",
|
||||
"'optLoadUserHistCiphers'+' = '+optLoadUserHistCiphers",
|
||||
"'optMatrixCodeRain'+' = '+optMatrixCodeRain",
|
||||
"'interfaceHue'+' = '+interfaceHue",
|
||||
"'interfaceSat'+' = '+interfaceSat",
|
||||
"'interfaceLit'+' = '+interfaceLit",
|
||||
"'fontHue'+' = '+fontHue",
|
||||
"'fontSat'+' = '+fontSat",
|
||||
"'fontLit'+' = '+fontLit",
|
||||
"'coderainHue'+' = '+coderainHue",
|
||||
"'coderainSat'+' = '+coderainSat",
|
||||
"'coderainLit'+' = '+coderainLit",
|
||||
"'optPhraseLimit'+' = '+optPhraseLimit",
|
||||
"'dbPageItems'+' = '+dbPageItems",
|
||||
"'dbScrollItems'+' = '+dbScrollItems",
|
||||
"'optForceTwoColumnLayout'+' = '+optForceTwoColumnLayout",
|
||||
"'optColoredCiphers'+' = '+optColoredCiphers",
|
||||
"'optGemSubstitutionMode'+' = '+optGemSubstitutionMode",
|
||||
"'optGemMultCharPos'+' = '+optGemMultCharPos",
|
||||
"'optGemMultCharPosReverse'+' = '+optGemMultCharPosReverse",
|
||||
// used to export/import settings — the NAMES of the option globals; exportCalcOptions() reads
|
||||
// window[name], importCalcOptions() accepts only these names (no eval on either side)
|
||||
"optNumCalcMethod",
|
||||
"optFiltCrossCipherMatch",
|
||||
"optFiltSameCipherMatch",
|
||||
"optHltSameCipher",
|
||||
"optShowOnlyMatching",
|
||||
"autoMatchEnabled",
|
||||
"optNewPhrasesGoFirst",
|
||||
"optShowExtraCiphers",
|
||||
"optAllowPhraseComments",
|
||||
"liveDatabaseMode",
|
||||
"optLetterWordCount",
|
||||
"optWordBreakdown",
|
||||
"optCompactBreakdown",
|
||||
"optShowCipherChart",
|
||||
"optGradientCharts",
|
||||
"optLoadUserHistCiphers",
|
||||
"optMatrixCodeRain",
|
||||
"interfaceHue",
|
||||
"interfaceSat",
|
||||
"interfaceLit",
|
||||
"fontHue",
|
||||
"fontSat",
|
||||
"fontLit",
|
||||
"coderainHue",
|
||||
"coderainSat",
|
||||
"coderainLit",
|
||||
"optPhraseLimit",
|
||||
"dbPageItems",
|
||||
"dbScrollItems",
|
||||
"optForceTwoColumnLayout",
|
||||
"optColoredCiphers",
|
||||
"optGemSubstitutionMode",
|
||||
"optGemMultCharPos",
|
||||
"optGemMultCharPosReverse",
|
||||
'"encDefAlphArr"+" = \x27"+String(encPrevAlphStr).replace(/,/g,"")+"\x27"',
|
||||
'"encDefVowArr"+" = \x27"+String(encPrevVowStr).replace(/,/g,"")+"\x27"',
|
||||
'"encDefExcLetArr"+" = \x27"+String(encPrevExcLetStr).replace(/,/g,"")+"\x27"',
|
||||
"'optImageScale'+' = '+optImageScale",
|
||||
"optImageScale",
|
||||
];
|
||||
|
||||
var runOnceRestoreCalcSet = true;
|
||||
|
||||
Reference in new issue
Block a user