refactor(wipe): drop dead method_cmd; wipe_drive is sole command source#39
Merged
Conversation
nist_method_for_type() returned a "tier|desc|command" triple, but the command field was pure duplication: wipe_drive extracted it into a never-used local (the SC2034 method_cmd warning) and no caller ever read field 3 — the audit log and operator display record field 2 (description). The duplicated command string was a latent advertised-vs-executed drift risk on a compliance-critical tool. - nist_method_for_type now returns "tier|description" only. - Removed the dead method_cmd extraction from wipe_drive (clears SC2034). - wipe_drive's case statement is now the single source of truth for the per-type command; each branch carries a "ref:" comment with its reference invocation so the documentation value isn't lost. - Updated tests/test_wipe-lib.bats to the two-field mapping. No change to any executed wipe command or to the audit schema. Resolves #49428.
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 #49428.
nist_method_for_type()returned atier|desc|commandtriple, but the command field was dead duplication:wipe_driveextracted it into a never-used local — the pre-existingSC2034 method_cmdwarning.The duplicated command string was a latent advertised-vs-executed drift risk on a compliance-critical tool. Per the chosen approach (DRY / single source of truth):
nist_method_for_typenow returns"tier|description"only.method_cmdextraction fromwipe_drive→ clears theSC2034for that var.wipe_drive'scasestatement is now the sole source of truth for the per-type command; each branch carries a# ref:comment with its reference invocation so the documentation isn't lost.tests/test_wipe-lib.batsupdated to the two-field mapping.No change to any executed wipe command, and no audit-schema change.
Testing
test_autorun0,test_setup_results_dir,test_wipe-lib,test-wipe-lib,test_verify_wipe).batsnot installed locally; verified the mapping by sourcing the lib directly — output matches the updatedtest_wipe-lib.batsassertions exactly.shellcheck --severity=warningonwipe-lib.sh:method_cmdSC2034 gone (remainingYELLOW/CYAN/remainderare pre-existing, out of scope).bash -nclean on wipe-lib/wipe-now/wipe-wizard.