AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 35 Bitcoin

refactor: drop non-dict JSON coercion in encryption storage

Public commit record

What the developer wrote

Authored by kkdao

85/100 · Strong
refactor: drop non-dict JSON coercion in encryption storage

Loading seeds.json no longer coerces valid-but-non-dict JSON to an
empty dict, so a wrong-shape file is preserved instead of being
silently overwritten on the next store. decrypt() keeps the
isinstance(source, dict) guard that prevents a crash on such files.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit changes how Krux loads its encrypted seed storage file. Previously, if the file contained valid JSON but in the wrong shape (for example, a list instead of a dictionary), the app would silently treat it as empty and overwrite it on the next save. Now the app keeps the file's original contents and relies on a separate safety check to avoid crashing. The change is described as a code cleanup, but it also removes a behavior that could hide or destroy user data if a storage file were tampered with or corrupted.

Recommended action

Review whether preserving a wrong-shaped seeds.json is the desired security posture, or whether the app should instead reject/alert the user and enter a safe recovery mode. Ensure decrypt()'s isinstance(source, dict) guard is consistently applied to all code paths that consume self.stored and self.stored_sd. Consider adding a test that verifies store_encrypted_kef() does not overwrite an existing non-dict file, and document the expected behavior for tampered storage files.

Security signals we found

01

Behavior change in persistence layer: malformed-shape but valid JSON is no longer silently normalized to empty dict

02

Potential data-loss vector removed: previous code would overwrite a non-dict seeds.json on next store

03

Crash-prevention guard retained in decrypt() for non-dict storage

04

No input validation or signature added for the loaded JSON object

05

Commit is framed as a refactor, not a security fix

Risk score

Why this scored 35/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 6/15
Affected reach 7/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.