Bash Rules

The bash section controls which shell commands Claude is allowed to run.

Configuration

bash:
  block_patterns:
    - name: dangerous_rm
      pattern: 'rm\s+-rf\s+/'
      severity: critical
      description: "Prevent recursive deletion from root"

    - name: history_wipe
      pattern: 'history\s+-[cwp]'
      severity: high
      description: "Prevent clearing shell history"

Fields

FieldRequiredDescription
nameyesUnique rule identifier (appears in audit log)
patternyesRegular expression (matched against the full command string)
severitynocritical, high, medium, low — informational only
descriptionnoHuman-readable note shown in audit log

Pattern matching

Patterns are matched against the complete command string passed to the Bash tool. The regex crate is used (linear-time DFA — no ReDoS risk). Patterns are anchored with re.is_match() (unanchored — match anywhere in the string).

Example: 'rm\s+-rf\s+/' matches rm -rf /, rm -rf /tmp, etc.

Default patterns

See config/rules.json for the full default set. Key defaults:

NamePattern
fork_bomb:\(\)\{.*\}\;:
dangerous_rmrm\s+-rf\s+[/~$]
history_wipehistory\s+-[cwp]
curl_pipe_shcurl.*|.*sh
wget_pipe_shwget.*-O-.*|.*sh
crypto_minerxmrig|minergate|minerd
exfil_netcatnc\s+.*\d+\.\d+\.\d+\.\d+

Disabling a default rule

Remove the pattern from your ~/.kiteguard/rules.json — there is no disabled flag. kiteguard only loads what is in your config file.