Expand description
Detection of dangerous commands that should never be executed.
This module implements hardcoded detection for commands that are inherently destructive or dangerous, regardless of their options.
Examples:
rm -rf /(destructive)git reset --hard(destructive)dd if=/dev/zero of=/dev/sda(very destructive)sudo rm(privilege escalation + destruction)
Functionsยง
- command_
might_ be_ dangerous - Checks if a command appears dangerous to execute. Returns true if the command should be blocked before execution.
- command_
requires_ approval - Returns whether the command crosses an inline-code boundary that must be admitted by an enforceable sandbox or explicit human approval.
- dangerous_
command_ reason - Reason a command tripped
command_might_be_dangerous, used for actionable preflight messages. Mirrors the git arm of [is_dangerous_to_call_with_exec] including env/sudo prefix unwrapping; non-git patterns keep the generic rejection text. - git_
global_ option_ requires_ prompt - Returns whether a git global option can redirect repository, config, or helper lookup and therefore must not be treated as an inspection flag.