aport-agent-guardrail
Pre-action authorization for AI agents. Installs an OpenClaw before_tool_call hook that evaluates every tool call against a passport and policy before execution. Blocks unauthorized commands, data exfiltration, and policy violations. Supports local (offline) and hosted (API) passport modes. Requires Node.js 18+ and npx.
- License 许可
- MIT
- 最近更新
- 2026-06-07
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- aport-agent-guardrail
- metadata
- { "tags": "security, guardrails, authorization, ai-agent, openclaw, aport, policy-enforcement", "author": "uchibeke", "version": "1.1.11" }
- description
- Pre-action authorization for AI agents. Installs an OpenClaw before_tool_call hook that evaluates every tool call against a passport and policy before execution. Blocks unauthorized commands, data exfiltration, and policy violations. Supports local (offline) and hosted (API) passport modes. Requires Node.js 18+ and npx.
03 SKILL.md 正文
APort Agent Guardrail
Pre-action authorization for AI agents. Installs an OpenClaw before_tool_call hook that
evaluates every tool call against a passport (identity + capabilities + limits) and policy
before it executes. If the policy denies the call, the tool does not run.
This skill provides setup instructions. The enforcement logic comes from the @aporthq/aport-agent-guardrails npm package, which is open-source (Apache 2.0) and can be audited before installation.
When to use this skill
- User wants to add guardrails to their AI agent setup
- User asks about protecting against unauthorized tool calls
- User wants pre-action authorization for OpenClaw, IronClaw, or PicoClaw agents
- User needs audit trails for AI agent actions
How it works
User Request -> Agent Decision -> APort Hook -> [ALLOW/DENY] -> Tool Execution
|
Policy + Passport
- Agent decides to use a tool (e.g., run a shell command)
- OpenClaw fires the
before_tool_callhook - APort loads the passport, maps the tool to a policy, checks allowlists and limits
- Decision: ALLOW (tool runs) or DENY (tool blocked)
- Decision is logged to the audit trail
Enforcement runs in the OpenClaw hook layer, not in agent prompts. However, like any application-layer security control, it depends on the integrity of the runtime environment (OS, OpenClaw, filesystem). See the Security Model for trust boundaries.
Prerequisites
Check these before starting:
- Node.js 18+ and npx — run
node -vto verify (must show v18 or higher) - OpenClaw (or compatible runtime) — the hook registers as an OpenClaw plugin
Installation
Quick start (recommended)
npx @aporthq/aport-agent-guardrails
The wizard will:
- Create or load a passport (local file or hosted from aport.io)
- Configure capabilities and limits
- Register the OpenClaw plugin (adds
before_tool_callhook) - Set up wrapper scripts under
~/.openclaw/
After install, the hook runs on every tool call automatically.
With hosted passport (optional)
npx @aporthq/aport-agent-guardrails <agent_id>
Get agent_id at aport.io for signed decisions,
global suspend, and centralized audit dashboards.
From source
git clone https://github.com/aporthq/aport-agent-guardrails
cd aport-agent-guardrails
./bin/openclaw
What gets installed
Files created under ~/.openclaw/:
- Plugin config in
config.yamloropenclaw.json - Wrapper scripts in
.skills/aport-guardrail*.sh aport/passport.json(local mode only)aport/decision.jsonandaport/audit.log(created at runtime)
Total disk usage: ~100KB for scripts + passport/decision files.
Usage
After installation, the hook runs automatically on every tool call:
# Allowed command — hook approves, tool executes
agent> run git status
# APort: passport checked -> policy evaluated -> ALLOW
# Blocked command — hook denies, tool does not run
agent> run rm -rf /
# APort: passport checked -> blocked pattern detected -> DENY
Testing the hook manually
# Test allowed command (exit 0 = ALLOW)
~/.openclaw/.skills/aport-guardrail.sh system.command.execute '{"command":"ls"}'
# Test blocked command (exit 1 = DENY)
~/.openclaw/.skills/aport-guardrail.sh system.command.execute '{"command":"rm -rf /"}'
Decision logs:
- Latest decision:
~/.openclaw/aport/decision.json - Audit trail:
~/.openclaw/aport/audit.log
Modes
Local mode (default)
- All evaluation happens on your machine, zero network calls
- Passport stored locally at
~/.openclaw/aport/passport.json - Works offline
- Note: local passport file must be protected from tampering (standard filesystem permissions)
API mode (optional)
- Passport hosted in the aport.io registry (not stored locally)
- Signed decisions (Ed25519) for tamper-evident audit trails
- Global suspend across all systems
- Centralized compliance dashboards
- Sends tool name + context to API (does not send file contents, env vars, or credentials)
Environment variables
All optional. Local mode requires no environment variables.
| Variable | When used | Purpose |
|---|---|---|
APORT_API_URL |
API mode | Override endpoint (default: https://api.aport.io) |
APORT_AGENT_ID |
Hosted passport | Passport ID from aport.io |
APORT_API_KEY |
If API requires auth | Authentication token |
Default protections
- Shell commands — Allowlist enforcement, 40+ blocked patterns (
rm -rf,sudo,chmod 777, etc.), interpreter bypass detection - Messaging — Rate limits, recipient allowlist, channel restrictions
- File access — Path restrictions, blocks access to
.env, SSH keys, system directories - Web requests — Domain allowlist, SSRF protection, rate limiting
- Git operations — PR size limits, branch restrictions
Tool name mapping
| Agent action | Tool name | Policy checks |
|---|---|---|
| Shell commands | system.command.execute |
Allowlist, blocked patterns |
| Messaging (WhatsApp/Email/Slack) | messaging.message.send |
Rate limits, recipient allowlist |
| PRs | git.create_pr, git.merge |
PR size, branch restrictions |
| MCP tools | mcp.tool.execute |
Server/tool allowlist |
| File read/write | data.file.read, data.file.write |
Path restrictions |
| Web requests | web.fetch, web.browser |
Domain allowlist |
Troubleshooting
| Problem | Fix |
|---|---|
| Plugin not enforcing | Check openclaw plugin list shows aport-guardrail |
| Connection refused (API mode) | Verify APORT_API_URL is reachable |
| Tool blocked unexpectedly | Check ~/.openclaw/aport/decision.json for deny reason |
| npx not found | Install Node.js 18+: https://nodejs.org |
Documentation
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
ceaser
Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp <subcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir/UltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).
ceaser-send
Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp <subcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir/UltraHonk zero-knowledge proofs.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
moldium
Post and manage content on the Moldium blog platform. Triggered by "post to Moldium", "write a blog post", "publish an article", etc.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http://weakaccept.top:8000/.