fix(storage): owner-only secret files + bound SQLite cache growth
- Write vault.dat atomically and 0600 (it holds the PIN-encrypted passphrase, so a world-readable copy enables an offline brute-force of the short PIN), and chmod the tx-history SQLite + its WAL/SHM sidecars to 0600 on open. - The tx-history snapshot and key-salt rows are keyed on a hash of the full address set, which changes whenever a new address is generated — orphaning the prior hash's full-history blob and salt forever. pruneOtherWallets() now drops rows for every non-live wallet hash on each save, bounding the database. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -77,6 +77,9 @@ private:
|
||||
std::vector<unsigned char>& nonce,
|
||||
std::vector<unsigned char>& cipherText);
|
||||
void clearWalletByHash(const std::string& walletHash);
|
||||
// Delete snapshot + salt rows for every wallet hash except the live one, bounding the
|
||||
// DB so generating a new address (which changes the hash) doesn't orphan history forever.
|
||||
void pruneOtherWallets(const std::string& keepWalletHash);
|
||||
void close();
|
||||
|
||||
sqlite3* db_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user