Skip to content

disk-hygiene: PowerShell guard misses move/rename/overwrite/format spellings #387

Description

@kyle-sexton

Summary

The PowerShell guard's mutation-spelling regex only catches delete/recycle spellings, so on Windows
— where the PowerShell lane is the real deletion/handoff path — common destructive operations get
no ask gate and pass silently.

Details

  • destructive_guard.py:217-223 (_POWERSHELL_MUTATION_WORDS) covers remove-item, rm, rmdir,
    del, erase, rd, ri, clear-content, rimraf, unlink, recycle-bin/::delete spellings.
  • It does not cover: Move-Item/move/mv, Rename-Item, Set-Content/Out-File/>
    redirection (overwrite), Remove-ItemProperty, Clear-Disk/Format-Volume, or New-Item -Force
    (which truncates an existing file).

The lane is documented as "raised bar, not fail-closed" (safety-model.md:63-66), which is a
deliberate design choice — but a silent move/overwrite of an approved-adjacent path during a manual
handoff is exactly the kind of destructive slip the lane is meant to surface.

Suggested fix

Extend the mutation-spelling set to include move/rename/overwrite/format spellings (at least
Move-Item/mv, Rename-Item, Out-File/Set-Content, New-Item -Force, Format-Volume/
Clear-Disk), surfacing the same ask bar. Document the covered set.

Severity

MEDIUM (security) on Windows; LOW elsewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: securitySecurity-relevant: vulnerability, hardening, or disclosure follow-up.needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions