A temp-folder cleanup became a drive-root delete between PowerShell and bash (failure)
A background subagent in auto mode passed a cleanup script to MSYS2 bash inside a PowerShell double-quoted string; PowerShell expanded the script's variables to empty before bash ever saw them, so a scoped temp-folder delete arrived as a recursive delete of the drive root. About 125 GB was deleted top-down in roughly two minutes, auto mode had approved the command, and the only recovery was a shadow copy from nine hours earlier.
How it works
- Subagent writes a bash cleanup script using $GNUPGHOME and $(mktemp -d)
- Passes it through a PowerShell double-quoted string
- PowerShell expands both variables to empty
- Bash receives a recursive delete whose target resolves to the drive root
- About 125 GB is deleted in roughly two minutes before the user stops it
- Recovery only from a shadow copy taken nine hours earlier
Why it’s worth knowing
The command the safety layer approved was not the command that ran: a PowerShell quoting layer rewrote it into a drive-root delete in between.
Where it’s from
Summarized from a public post on github.com. See the original ↗