fix: harden mtm-ddwipe confirmation and wipe flow

Add strict shell options, root and block-device validation, and a typed-device confirmation prompt before wiping. Preserve the fallback wipe sequence through secure discard, zero discard, and dd, while tightening error handling and keeping messages concise.
This commit is contained in:
2026-04-27 23:32:45 +02:00
parent 7011426381
commit ecc6e5b038
2 changed files with 122 additions and 75 deletions
+13 -12
View File
@@ -4,25 +4,26 @@ description: mtm-ddwipe project conventions
# Project conventions
- Use English throughout the project.
- Keep shell scripts Bash-based when Bash is already used by the project.
- Preserve the current behavior of the main script:
- `mtm-ddwipe`: wipe devices.
- Strengthen destructive-action safety checks in `mtm-ddwipe` when making changes.
- Keep `mtm-ddwipe` interactive by default unless a change explicitly adds a safe opt-in flag.
- Keep user-facing messages short, clear, and in English.
- Prefer minimal, focused changes that do not alter the intent of the existing scripts, unless the script behavior is intentionally updated.
- Maintain `.continue/rules/project.md` whenever project conventions or script behavior change.
- Keep shell scripts Bash-based.
- Preserve the current behavior of the main script: `mtm-ddwipe` wipes block devices.
- Strengthen destructive-action safety checks in `mtm-ddwipe`.
- Keep `mtm-ddwipe` interactive by default.
- Require explicit confirmation before destructive actions.
- Keep user-facing messages short and clear.
- Keep error and help messages short and clear.
- Prefer minimal, focused changes that preserve intent.
- Keep `.continue/rules/project.md` aligned with project conventions and concise.
- `mtm-ddwipe` is a small Bash script with helper functions.
- Keep the host and line-number removal behavior intact.
- Keep the host and line-number removal behavior intact for related output processing.
- `mtm-ddwipe` must print a usage line and support `-h`/`--help`.
- Validate that wipe targets are real block devices before operating on them.
- Keep short, explicit confirmation prompts before destructive operations.
- Keep error and help messages short, clear, and in English.
- Prefer confirmation prompts that require typing the target device path.
- Keep help text concise and usage-first.
- When changing `mtm-ddwipe`, keep destructive safeguards strict and explicit.
- Keep destructive safeguards strict and explicit.
- If adding non-interactive support, make it an opt-in safety flag.
- Keep device identification prompts clear and specific.
- Preserve the fallback wipe flow unless the change is intentionally about wiping behavior.
- Preserve the fallback wipe flow: secure discard, zero discard, then zero-fill with `dd`.
# Project identity
- Main script: `mtm-ddwipe`