GuardRail
github.com/fvdhmbai/guardrail- Category
- Developer Tools
- Rank
- No. 2542Tools index
Previous survey · No. 2410 ·
- Listed in
- #1 Review code for security
- Pricing
- Freemium
- Type
- TOOL
- Use case
- Security & Identity
- Interfaces
- Agent Skill / Plugin
- Latest release
- v0.3.1
- Date
About
GuardRail is an open-source, MIT-licensed set of guards that hook into AI coding agents like Claude Code to block dangerous shell commands and file writes (e.g. rm -rf on protected paths, destructive SQL, force pushes, secret leaks) before they execute, logging every block. A paid Pro tier adds PII output scanning and EU AI Act compliance reporting for teams.
What it does
A safety layer for Claude Code built entirely from bash scripts. It registers itself as the agent's permission hook, so every shell command and file write is checked by a chain of small pattern-matching rules before it runs. A rule can refuse the action, attach a warning, or, after a command finishes, add a note to the agent's next turn when the output looks like a secret dump or an injection attempt. Refusals go to a local audit log that stores a hash of the command rather than the command itself.
Why it's ranked here
The core mechanism is honest engineering: it fails closed, so a missing rule file, a crashed rule or a malformed request blocks the command instead of waving it through. The installer proves the hook works before trusting it, firing a push to the main branch and expecting a refusal. An adversarial suite of roughly fifty cases runs on Linux and macOS in CI, MIT licensed. Against that, the documentation disagrees with the code in places that matter to a security tool, which keeps the verdict mixed.
What's good
The agent cannot switch it off. Disabling requires an interactive terminal, a typed confirmation and a token signed with a secret created at install time, and it expires after 30 minutes. Attempts from a non-interactive shell are logged as bypass attempts. Installs are staged and rolled back if any probe fails, including a check that a harmless file write is still allowed. The test cases go beyond the obvious: absolute binary paths, busybox and env wrappers, SQL deletes hidden behind comments, and broad WHERE clauses that still touch every row.
Tradeoffs
Protection is regular-expression matching on command text, so it catches the forms it anticipates, not arbitrary ones. The database rule only runs when the command names the Postgres command-line client. The guard catalogue lists default protected paths that differ from the defaults the code ships, and it counts 18 core guards where only 13 load; nine, including the loop detector, sit in the repository unused, yet the comparison table credits loop detection. Only Claude Code is supported today. The installer closes with a star request and a book plug, and Pro features check a remote licence server.
How to use it well
Fits a solo developer or small team running Claude Code with real credentials on the machine, who wants a cheap backstop against a pushed main branch, a recursive delete or a key posted to a request-capture site. Set your own protected tables, branches and paths in the config file rather than trusting the documented defaults, then run the built-in attack simulation to see what actually trips. Treat it as one layer: it does not sandbox the agent, and it does nothing for Codex or Gemini users yet.
Technical notes+
dispatchers/pre-bash.sh hard-codes seven core guards plus mass_update_guard (loaded only when the lowercased command contains psql, pgcli or docker exec with psql), then sources guards/custom and, if licensed, guards/pro; every load or hook failure routes to deny(). The .disabled flag is honoured only if its HMAC-SHA256 token matches and age is under 1800s. install.sh copies an explicit 13-guard list, probes pre-bash.sh for deny on git push origin main and allow on npm test, probes the edit dispatcher, and rolls back on failure. lib/guardrail-common.sh defaults GUARDRAIL_PROTECTED_PATHS to /home/ /etc/ /var/lib/docker /var/lib/postgresql, while docs/guards.md states /etc /usr /var /boot. lib/guardrail-license.sh posts the key to a remote API with a 24h cache and 72h offline grace. docs/architecture.md claims no network calls and 18 core guards.
Observed
- License
- MIT (LICENSE, package.json)
- Language
- Bash, with jq and openssl as runtime requirements
- Install surface
- npm package guardrail-agent exposing a guardrail CLI; npx guardrail-agent init
- Platform support
- Linux and macOS (package.json os field; CI matrix ubuntu-latest and macos-latest in .github/workflows/ci.yml)
- Agent support
- Claude Code hooks only; Codex CLI and Gemini CLI adapters described as planned
- Failure mode
- Fail-closed: malformed payloads and guard load or runtime errors deny the command (dispatchers/pre-bash.sh)
- Tests
- Adversarial dispatcher suite in tests/adversarial.sh, run by npm test in CI
- Core guards loaded
- 13 installed by install.sh; nine further guard files in the repository are not loaded by any dispatcher (README.md)
- Documentation drift
- docs/guards.md default protected paths differ from lib/guardrail-common.sh defaults
- Paid tier
- Pro guards gated by a licence key validated against a remote API (lib/guardrail-license.sh)
Read from README.md, package.json, docs/architecture.md, docs/guards.md, install.sh, bin/guardrail.sh, dispatchers/pre-bash.sh, lib/guardrail-common.sh, lib/guardrail-license.sh, guards/core/destructive_path_guard.sh, guards/core/basic_secret_detector.sh, guards/core/self_bypass_guard.sh, tests/adversarial.sh, .github/workflows/ci.yml, LICENSE.
What it can do
Block destructive shell commands (e.g. rm -rf on protected paths, force pushes) before execution
Shell command from AI coding agent → Blocked/allowed command decision
Block destructive SQL statements before execution
SQL command from AI coding agent → Blocked/allowed command decision
Block file writes that leak secrets
File write operation from AI coding agent → Blocked/allowed write decision
Log every blocked command or action
Blocked command/event → Log entry
Scan AI output for personally identifiable information (Pro tier)
AI-generated output text → PII scan results
Intel on GuardRail
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.