$ shellfirm

Auto-Deny Configuration

Automatically deny risky commands for unattended agents and automation

When AI agents or automated scripts run without human supervision, they cannot solve interactive challenges. shellfirm's auto-deny feature automatically blocks commands that meet or exceed a configurable severity threshold.

How it works

In agent mode, shellfirm evaluates every command against the check pattern database. If any matched pattern has a severity at or above the auto-deny threshold, the command is denied. Commands below the threshold are allowed.

Command: "git push --force origin main"
  Matched: git:force_push (High)
  Auto-deny threshold: High
  Result: DENIED ("Severity HIGH meets or exceeds agent auto-deny threshold HIGH")

Command: "git stash drop"
  Matched: git:stash_drop (Medium)
  Auto-deny threshold: High
  Result: ALLOWED (Medium < High)

Command: "echo hello"
  Matched: (none)
  Result: ALLOWED (no matches)

Configuration

Set the auto-deny threshold in ~/.shellfirm/settings.yaml:

agent:
  auto_deny_severity: High

Severity levels

The available severity levels, from lowest to highest:

LevelDescription
InfoInformational, nearly always safe
LowMinor risk, usually safe
MediumModerate risk, could cause limited damage
HighSignificant risk, could cause substantial damage
CriticalExtreme risk, could cause catastrophic damage

Choosing a threshold

ThresholdEffectUse case
InfoDenies everything that matches any patternMaximum safety, minimal agent autonomy
LowDenies Low and aboveVery conservative
MediumDenies Medium and aboveBalanced safety
HighDenies High and above (default)Allows routine operations, blocks dangerous ones
CriticalOnly denies Critical severityMaximum agent autonomy, blocks only the most dangerous

The default is High, which blocks dangerous operations like force pushes, recursive deletes, and namespace deletions while allowing routine operations.

Deny lists take priority

Commands matching patterns on the deny list are always denied, regardless of severity or auto-deny threshold. Deny lists come from two sources:

  1. Global deny list in ~/.shellfirm/settings.yaml:
deny_patterns_ids:
  - "git:force_push"
  - "fs:format_filesystem"
  1. Project deny list in .shellfirm.yaml:
version: 1
deny:
  - "kubernetes:delete_namespace"
  - "database:drop_database"

Human approval flag

For workflows where denied commands should be escalated to a human rather than simply blocked, enable the require_human_approval flag:

agent:
  auto_deny_severity: High
  require_human_approval: true

When enabled, the risk assessment includes requires_human_approval: true for denied commands. Your agent or automation framework can use this flag to route the command to a human for review instead of silently blocking it.

Per-environment configuration

You can use different auto-deny thresholds in different environments by maintaining separate settings files:

# Development: lenient
# ~/.shellfirm/settings.yaml
agent:
  auto_deny_severity: Critical

# Production server: strict
# /etc/shellfirm/settings.yaml
agent:
  auto_deny_severity: Medium

Examples

Agent tries a high-severity command

// check_command("git push --force origin main")
{
  "allowed": false,
  "severity": "High",
  "matched_rules": [{
    "id": "git:force_push",
    "description": "Force push can overwrite remote history.",
    "severity": "High",
    "group": "git"
  }],
  "denial_reason": "Severity HIGH meets or exceeds agent auto-deny threshold HIGH",
  "alternatives": [{
    "command": "git push --force-with-lease",
    "explanation": "Prevents overwriting others' work",
    "source": "regex-pattern"
  }]
}

Agent tries a medium-severity command (allowed)

// check_command("git stash drop")
{
  "allowed": true,
  "severity": "Medium",
  "matched_rules": [{
    "id": "git:stash_drop",
    "description": "Drops a stash entry permanently",
    "severity": "Medium",
    "group": "git"
  }],
  "denial_reason": null,
  "alternatives": []
}