Skip to content

fix(gate): W1 wipe-misfire — tri-state sm_ dispatch (STAGED, donor-gated)#1

Open
LxveAce wants to merge 1 commit into
masterfrom
dms/w1-wipe-misfire-tristate
Open

fix(gate): W1 wipe-misfire — tri-state sm_ dispatch (STAGED, donor-gated)#1
LxveAce wants to merge 1 commit into
masterfrom
dms/w1-wipe-misfire-tristate

Conversation

@LxveAce

@LxveAce LxveAce commented Jul 16, 2026

Copy link
Copy Markdown
Owner

W1 wipe-misfire fix (audit DEADMANS-AUDIT-2026-07-12 §GateInput_serial.cpp:313)

Bug: the caller overloaded processCommand()'s bool return so BOTH a deliberate sm_wipe AND any unrecognized sm_ line returned false, then routed false unconditionally into the authenticated wipe prompt (p="wipe"). A typo (sm_reboot), an unknown/future command, or a mangled keyword (sm_wipe\t, sm_wipex) dropped the operator into the wipe prompt; entering the correct password there fired an irreversible wipe. SPEC §6.1 violation.

Fix: extract classification into a pure, Arduino-free header (SmCommand.h) returning a tri-state (Handled | WipeRequest | Unknown). ONLY a clean sm_wipe maps to WipeRequest; an unrecognized sm_ line is Unknown → the caller emits an error and re-prompts, never wipes, never counts an attempt. Behaviour-preserving for every recognized command.

Verification

  • SmCommand.h + native test compile clean + warning-free under the ESP32 xtensa g++ (-fsyntax-only -Wall -Wextra -std=c++17), local.
  • New host test firmware/test_harness/native/test_sm_command.cpp asserts the full table + the single safety invariant (no input other than a clean sm_wipe yields WipeRequest); wired into CI (native-tests.yml, host g++ -Werror) — this PR runs it.
  • Full-firmware link stage stays the known WIP RED (build.yml, unrelated to this change).

⚠ DO NOT MERGE until donor-validated

Per the standing irreversibility gate: the on-board wipe-trigger validation (confirm real sm_wipe+password still wipes; confirm sm_reboot now re-prompts and never wipes) is HELD for the owner's donor board (not yet arrived). This PR is staged for review + CI, not for merge to master.

…m_wipe reaches the wipe flow

Audit DEADMANS-AUDIT-2026-07-12 GateInput_serial.cpp:313: the caller overloaded processCommand()'s
bool return so BOTH a deliberate sm_wipe AND any unrecognized sm_ line returned false, then routed
false unconditionally into the authenticated wipe prompt (p="wipe"). A typo (sm_reboot), an
unknown/future command, or a mangled keyword (sm_wipe\t, sm_wipex) therefore dropped the operator
into the wipe prompt; entering the correct password there fired an irreversible wipe (SPEC 6.1
violation: unrecognized SM_ must be a deferred error reply, never a password attempt, never wipe).

Fix: extract the classification into a pure, Arduino-free header (SmCommand.h: classifySmCommand +
smDispatch) and return a TRI-STATE (Handled | WipeRequest | Unknown). ONLY a clean sm_wipe maps to
WipeRequest; an unrecognized sm_ line is Unknown -> the caller emits an error and re-prompts, never
wipes, never counts an attempt. Behaviour-preserving for every recognized command.

Verify:
- SmCommand.h + native test compile clean + warning-free under the ESP32 xtensa g++ (-fsyntax-only
  -Wall -Wextra -std=c++17).
- New host test firmware/test_harness/native/test_sm_command.cpp asserts the full table + the single
  safety invariant (no input other than a clean sm_wipe yields WipeRequest); wired into CI
  (.github/workflows/native-tests.yml, runs on every push under host g++ -Werror).
- HELD for the owner's donor board: the on-board wipe-trigger validation (real sm_wipe+password still
  wipes; sm_reboot now re-prompts and never wipes). Not merged to master until donor-validated.
- Full-firmware link stage stays the known WIP RED (build.yml, unrelated to this change).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant