feat(wipe): opt-in multi-pass overwrite (WIPE_OVERWRITE_ROUNDS)#40
Merged
Conversation
Adds an optional, stricter-than-NIST multi-pass overwrite for random- overwrite wipe methods (HDD, USB flash, frozen-SSD fallback). The default stays 1 pass — NIST SP 800-88 Rev. 1 compliant — so behavior is unchanged unless an operator opts in. SSD erase/crypto methods are unaffected. Configuration resolves in this precedence order (highest first): 1. WIPE_OVERWRITE_ROUNDS environment variable 2. ssr.overwrite-rounds=N on the kernel cmdline 3. WIPE_OVERWRITE_ROUNDS=N in the baked /wipe.env on the USB root 4. default: 1 Only positive integers are accepted; an invalid value at one source is warned about and the next source is tried, so a bad value never silently drops the pass count (0 is rejected). - resolve_overwrite_rounds() + overwrite_rounds_for_type() helpers in wipe-lib.sh; the nwipe overwrite invocations now use --rounds="$rounds". - The effective pass count is recorded per drive in the JSON audit log as "overwrite_rounds" (null for erase/crypto methods) — both the wizard (append_drive_audit) and eWaste (wipe-now.sh) paths. - New config/wipe.env baked onto the FAT32 root by build-wipe-usb.sh (both block-device and image write paths). - docs/usage.md documents the tunable and the NIST note. - tests/test_overwrite_rounds.sh covers precedence, validation/fall-through, and the audit mapping (cmdline/config sources are overridable via WIPE_CMDLINE_FILE / WIPE_CONFIG_FILE for testing). Resolves #49427.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #49427 (follow-up from #48091/FR-099). Adds an optional stricter-than-NIST multi-pass overwrite for random-overwrite wipe methods (HDD, USB flash, frozen-SSD fallback).
The default stays 1 pass — NIST SP 800-88 Rev. 1 compliant — so behavior is unchanged unless an operator opts in. SSD erase/crypto methods are unaffected.
Per the chosen "Both" config design, the pass count resolves in this precedence order (highest first):
WIPE_OVERWRITE_ROUNDSenvironment variablessr.overwrite-rounds=Non the kernel cmdline (parsed like the existingssr.include-usb)WIPE_OVERWRITE_ROUNDS=Nin the baked/wipe.envon the FAT32 root1Only positive integers are accepted; an invalid value at one source is warned about and the next source is tried, so a bad value never silently drops the pass count (
0is rejected).Changes
resolve_overwrite_rounds()+overwrite_rounds_for_type()inwipe-lib.sh; the threenwipeoverwrite invocations now use--rounds="$rounds"(erase branches untouched).overwrite_rounds(nullfor erase/crypto), in both the wizard (append_drive_audit) and eWaste (wipe-now.sh) paths.config/wipe.env, baked onto the FAT32 root bybuild-wipe-usb.sh(both block-device and image write paths).docs/usage.mddocuments the tunable + the NIST "single pass is sufficient" note.Testing
tests/test_overwrite_rounds.sh(16 cases): precedence, validation/fall-through (invalid env→cmdline→file→default, zero rejected), and the audit mapping. Sources are overridable viaWIPE_CMDLINE_FILE/WIPE_CONFIG_FILEfor hermetic testing.nulland integeroverwrite_rounds;shellcheck --severity=warningadds no new warnings (the 3 pre-existingYELLOW/CYAN/remainderremain);bash -nclean on all touched scripts.Frozen-SSD caveat
A frozen
sata-ssdfalls back to overwrite at runtime, but the audit classifies by nominal method, so that exceptional path recordsoverwrite_rounds: null. Documented in a code comment; not worth runtime plumbing here.