{"version":"2.1.331","anchor":"rm-on-possibly-empty-variable-path-gets-rewritten-with-a-gua","canonical_anchor":"rm-on-possibly-empty-variable-path-gets-rewritten-with-a-gua","heading":"Risky rm commands on a variable path can be rewritten to stop if the variable is empty","tier":"soon","area":"Bash Safety","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.331\/e\/rm-on-possibly-empty-variable-path-gets-rewritten-with-a-gua","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.331","markdown":"### Risky rm commands on a variable path can be rewritten to stop if the variable is empty\n\nWhen switched on, Claude Code rewrites rm commands on a variable path so they abort instead of running if that variable turns out to be empty\n\n**What**\n\nWhen Claude wants to run an `rm` command (the shell command that deletes files) on a path built from a variable, such as `rm -rf $VAR\/`, Claude Code can now rewrite the command to use `${VAR:?}` instead. With that form, the shell stops with an error if the variable is empty, rather than running the delete on whatever path is left.\n\nThe permission prompt gives the reason as \"Dangerous rm operation on possibly-empty variable path\".\n\nThis is controlled by a remote setting. It is off unless it is switched on remotely with a specific value.\n\n**Why**\n\nAn empty variable can turn `rm -rf $VAR\/` into `rm -rf \/`, which deletes far more than intended. Where this is active, the command that actually runs is the guarded version, so an empty variable makes it fail safely.\n\n- Flag `tengu_purring_naur`: Not enough to say (read for one account on one subscription tier against v2.1.331; this account: no value returned, anonymous baseline: no value returned, compiled default: not a boolean we can read) These values were read against a different version of Claude Code, so treat them as the nearest reading available instead of one taken on this release.\n- Area: Bash Safety\n- Tier: Nothing to try yet\n- Useful: 3\/5\n- Signal: 3\/5\n- Scope: individual\n- Heads-up: no\n- Present in the build but not switched on"}