⌘

Bash Guardian

v2.0.0AST Scan: 0 CriticalSource PublicCLI v2.1.287+ Tested

POSIX command sanitizer preventing accidental recursive deletes, fork bombs, and sudo privilege escalation.

@system-armor•★2,100 stars•↓9,500 active installs•MIT License
View Source ↗
⚡Installation Specifier
$/plugin install bash-guardian@marketplace
ℹUninstall anytime:claude plugin uninstall bash-guardian@marketplace

Problem Solved & Architectural Motivation

Analyzes shell command pipelines before OS execution. Replaces unquoted variables, checks sudo requirements, and converts dangerous recursive deletes into safe dry-run previews.

Before Execution

Zero-Time AST Interception

Evaluates tool payloads prior to kernel fork.

Scoring Model

0-100 Impact Index

Weighted heuristic scoring: files touched, git dirty state, env scope.

Non-Intrusive

Native CLI Hook

Zero proxy daemon required; hooks straight into Claude tool calls.

Lifecycle Architecture & Hook Flow

POSIX Event Engine
Step 01
Claude Plan
Prompt Inference
→
Step 02
Tool Call
tool.call Payload
→
HOOK INTERCEPT
bash-guardian
<18ms Heuristic
→
Step 04
OS Execution
Kernel Fork

Manifest Schema (plugin.json)

{
  "name": "bash-guardian",
  "version": "2.0.0"
}

Hook Implementation (register.js)

TypeScript SDK
export default function guardian(sdk) {
  sdk.on('tool.call:execute_bash', ({ command, rewrite, abort }) => {
    if (command.includes('rm -rf /') || command.includes(':(){ :|:& };:')) {
      return abort('Catastrophic shell pattern intercepted by Bash Guardian.');
    }
  });
}
Static Security AuditTested commit e4b91f2
0 Critical
SubprocessesClean (No Exec)
Dynamic Code (eval)Clean (0 eval)
Credential ExposureClean (0 leaks)
Network EgressZero Socket Egress
Filesystem ScopeWorkspace Bound
Read 6-Point Audit Methodology ↗

Static heuristic checks only. Not a formal commercial certification or warranty. Review source before installing.

Technical Specifications

Min CLI Versionv2.1.287+
Categorytool-guards
Runtime Overhead< 18ms AST
LicenseMIT
Mod Publisher