fix(console): confirmed destructive commands now run; gate z_exportmnemonic

Two gaps in the destructive-command confirm:
- Regression: a command confirmed via the command-reference dialog's "Run" was
  replayed through submitConsoleCommand, which re-armed the destructive gate and
  silently did nothing until the user retyped it. The dialog now pre-arms the
  exact-line confirm so the replay executes.
- z_exportmnemonic (full-node seed-phrase reveal) wasn't in the reference
  catalog, so a pasted z_exportmnemonic ran instantly. Added a small
  secret-revealing fallback set (z_exportmnemonic, z_exportviewingkey) to the
  destructive check. Command execution is otherwise unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 23:51:06 -05:00
co-authored by Claude Opus 4.8
parent 097b2ea014
commit e94d88e723
+9
View File
@@ -1552,6 +1552,12 @@ bool IsDestructiveConsoleCommand(const std::string& firstLower, bool fullNode)
if (n == firstLower) return cat.commands[i].destructive;
}
}
// Secret-revealing full-node commands that aren't in the reference catalog still deserve the gate
// (e.g. z_exportmnemonic dumps the seed phrase; the lite "seed" equivalent is already flagged).
if (fullNode) {
static const char* kSecretReveal[] = { "z_exportmnemonic", "z_exportviewingkey" };
for (const char* s : kSecretReveal) if (firstLower == s) return true;
}
return false;
}
} // namespace
@@ -1882,6 +1888,9 @@ void ConsoleTab::renderCommandDetail(const ConsoleCommandEntry& cmd, const char*
ImGui::SameLine();
if (material::TactileButton(TR("console_ref_run"), ImVec2(cbw, 0))) {
pending_submit_ = built;
// The reference dialog already confirmed this run, so pre-arm the destructive gate to an exact
// match — otherwise the replayed submit re-arms it and silently does nothing until retyped.
destructive_confirm_cmd_ = built;
command_search_[0] = '\0';
run_confirm_cmd_ = nullptr;
show_commands_popup_ = false;