security(console): mask key-dump command RESULTS in the scrollback
The console redacted secret command ARGS but showed the OUTPUT of key-revealing commands (dumpprivkey / z_exportkey / z_exportviewingkey / z_exportmnemonic / dumpwallet / z_exportwallet, and the lite seed/export verbs) in full — visible in the scrollback, Copy All, Ctrl+C and the filter. Now, when the submitted command is key-revealing, its result is held ONLY in a member buffer (never in the scrollback model, so Copy-All etc. can't leak it) and a masked placeholder is shown. An explicit "Copy secret" button routes through the auto-clearing clipboard; the buffer auto-wipes after 60s, on Clear, and on wallet lock (via wipeDisplayedSecrets). The command string passed to the executor is byte-identical. New pure helper ConsoleCommandRevealsSecret is unit-testable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,25 @@ bool ConsoleCommandCarriesSecret(const std::string& cmd)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConsoleCommandRevealsSecret(const std::string& cmd, bool fullNode)
|
||||
{
|
||||
size_t end = 0;
|
||||
const std::string name = firstConsoleTokenLower(cmd, end);
|
||||
if (name.empty()) return false;
|
||||
if (fullNode) {
|
||||
static const char* const kFull[] = {
|
||||
"dumpprivkey", "z_exportkey", "z_exportviewingkey",
|
||||
"z_exportmnemonic", "dumpwallet", "z_exportwallet",
|
||||
};
|
||||
for (const char* s : kFull) if (name == s) return true;
|
||||
} else {
|
||||
// Lite backend verbs whose output is the seed phrase / private keys.
|
||||
static const char* const kLite[] = { "seed", "export" };
|
||||
for (const char* s : kLite) if (name == s) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string RedactConsoleCommand(const std::string& cmd)
|
||||
{
|
||||
size_t end = 0;
|
||||
|
||||
Reference in New Issue
Block a user