Development record
The shell guard allows recursive deletes of the home directory spelled three ways its arg_values compare does not read: a backslash-newline inside the variable's name (rm -rf $HO<backslash-newline>ME, which bash reads as $HOME and the guard spells ${HO}ME), a variable inside a brace expansion (rm -rf {$HOME,x}, rm -rf $HOME/{.*,}), whose words carry no written spelling, and a parameter expansion of HOME with an operator (rm -rf ${HOME%/}, ${HOME:-x}, ${HOME#}, ${HOME/x/x}, ${X:+$HOME}), whose value can be the home but whose spelling is not one of the words the entry names. rm-rf-root-or-home promises to block a recursive delete of the home wherever it stands, and each of these deletes it. Present at main a018e7ca2 and at 8cd7f88f4.
The shell guard allows recursive deletes of the home directory spelled three ways its arg_values compare does not read: a backslash-newline inside the variable's name (rm -rf $HO<backslash-newline>ME, which bash reads as $HOME and the guard spells ${HO}ME), a variable inside a brace expansion (rm -rf {$HOME,x}, rm -rf $HOME/{.*,}), whose words carry no written spelling, and a parameter expansion of HOME with an operator (rm -rf ${HOME%/}, ${HOME:-x}, ${HOME#}, ${HOME/x/x}, ${X:+$HOME}), whose value can be the home but whose spelling is not one of the words the entry names. rm-rf-root-or-home promises to block a recursive delete of the home wherever it stands, and each of these deletes it. Present at main a018e7ca2 and at 8cd7f88f4.
Grounds
- pursued: each named spelling blocks bare, in bash -c and (where the outer shell leaves it the home) in sh -c, and 12,595 pre-existing inputs change only on the two pins this fix flips; a home-deleting spelling of those three shapes that allows, or an old input that loosens, would show it wrong
Frontmatter
| id | iss-2609290419119456 |
|---|---|
| type | issue |
| lifecycle | resolved |
| severity | major |
.abcd/work/issues/resolved/iss-2609290419119456-the-shell-guard-allows-recursive-deletes.md
open on GitHub ↗ · commit history ↗