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
+2
-2
@@ -241,10 +241,10 @@ function exportCiphersDB(expAllCiph = false) {
|
||||
return out
|
||||
}
|
||||
|
||||
function exportCalcOptions() {
|
||||
function exportCalcOptions() { // one JSON string per option: "name = value" (same text as before for booleans/numbers); values read by name, never eval'd
|
||||
var o = "calcOptions = [\n\t"
|
||||
for (var i = 0; i < calcOptionsArr.length; i++) {
|
||||
o += "\x22"+eval(calcOptionsArr[i])+"\x22,\n\t" // quotes - \x22
|
||||
o += JSON.stringify(calcOptionsArr[i]+" = "+JSON.stringify(window[calcOptionsArr[i]]))+",\n\t"
|
||||
}
|
||||
o = o.slice(0,-3) + "\n]\n" // remove comma, new line, tab; new line, close array, new line
|
||||
return o
|
||||
|
||||
Reference in new issue
Block a user