Imported from modbender/skill-library-mcp (
data/aport-agent-guardrail/SKILL.md). Install upstream withnpx skills add modbender/skill-library-mcp --skill aport-agent-guardrail. Copyright stays with the author.
APort Agent Guardrail
Skill identifier: aport-agent-guardrail Β· Category: Security / Infrastructure
π‘οΈ What This Skill Does
Pre-action authorization for AI agents. Every tool call is evaluated against a passport (identity + capabilities + limits) and policy before it executes. If denied, the tool never runs.
Key features:
- β
Deterministic enforcement β Runs in
before_tool_callhook; agent cannot bypass - β Blocks malicious actions β Unauthorized commands, data exfiltration, API abuse prevented
- β Structured policies β Based on Open Agent Passport (OAP) v1.0
- β Fail-closed by default β Errors deny tool execution (security over availability)
- β Audit trail β Every decision logged with tamper-evident hashes
- β Framework-agnostic β OpenClaw, IronClaw, PicoClaw, and compatible runtimes
How it protects you:
- Prompt injection β Agent cannot bypass hook-based enforcement
- Malicious skills β All tool calls checked regardless of source
- Unauthorized commands β Allowlist + 40+ blocked patterns (rm -rf, sudo, etc.)
- Data exfiltration β File access, messaging, web requests controlled
- Resource exhaustion β Rate limits, size caps enforced
Install once, protected forever. The plugin runs automatically on every tool call.
β‘ Quick Start
# Install APort guardrails (one-time setup)
npx @aporthq/aport-agent-guardrails
# Follow wizard to create passport and configure policies
# Plugin auto-registers with OpenClaw
# Now your agent is protected
# All tool calls checked before execution
With hosted passport (optional):
# Get agent_id from aport.io
npx @aporthq/aport-agent-guardrails <agent_id>
Requirements: Node 18+, jq
π¦ Installation
Option 1: npm (recommended)
npx @aporthq/aport-agent-guardrails
The wizard will:
- Create or load passport (local file or hosted from aport.io)
- Configure capabilities and limits
- Install OpenClaw plugin automatically
- Set up wrapper scripts
After install: Plugin enforces before every tool call. No further action needed.
Option 2: With hosted passport
npx @aporthq/aport-agent-guardrails <agent_id>
Get agent_id at aport.io for:
- Cryptographically signed decisions
- Global suspend (<200ms across all systems)
- Centralized audit and compliance dashboards
- Team collaboration
Option 3: From source
git clone https://github.com/aporthq/aport-agent-guardrails
cd aport-agent-guardrails
./bin/openclaw
Guides:
π Usage
Automatic enforcement (default)
After installation, the plugin runs automatically:
# Your agent uses tools normally
agent> run git status
# β
APort: passport checked β policy evaluated β ALLOW β tool executes
agent> run rm -rf /
# β APort: passport checked β blocked pattern detected β DENY β tool blocked
You do nothing. The plugin enforces on every tool call in the background.
Testing the guardrail (optional)
Direct script calls for testing or automation:
# Test allowed command
~/.openclaw/.skills/aport-guardrail.sh system.command.execute '{"command":"ls"}'
# Exit 0 = ALLOW
# Test blocked command
~/.openclaw/.skills/aport-guardrail.sh system.command.execute '{"command":"rm -rf /"}'
# Exit 1 = DENY
# Test messaging
~/.openclaw/.skills/aport-guardrail.sh messaging.message.send '{"channel":"whatsapp","to":"+15551234567"}'
Exit codes:
0= ALLOW (tool may proceed)1= DENY (reason in decision.json)
Decision logs:
- Latest:
~/.openclaw/aport/decision.json - Audit trail:
~/.openclaw/aport/audit.log - API mode: Signed receipts via APort API
π How It Works
Pre-Action Authorization Flow
User Request β Agent Decision β APort Check β [ALLOW/DENY] β Tool Execution
β
Policy + Passport
- User makes request (e.g., "Deploy to production")
- Agent decides to use tool (e.g., exec.run with git push)
- OpenClaw fires hook (
before_tool_call) - APort evaluates:
- Load passport (identity, capabilities, limits)
- Map tool β policy (exec β system.command.execute.v1)
- Check allowlist, blocked patterns, rate limits
- Decision: ALLOW or DENY
- Audit: Log decision with timestamp, policy, reason codes
Agent cannot bypass. Hook is registered by OpenClaw, not controlled by prompts.
What Gets Installed
Plugin registration:
- OpenClaw plugin added to config (enforces before_tool_call)
- TypeScript/JavaScript plugin loaded on OpenClaw start
Files created (under ~/.openclaw/):
config.yamloropenclaw.jsonβ Plugin configuration.skills/aport-guardrail*.shβ Wrapper scripts for local/API evaluationaport/passport.jsonβ Your agent passport (local mode only)aport/decision.jsonβ Latest decision (runtime)aport/audit.logβ Audit trail (runtime)
Total disk usage: ~100KB scripts + your passport/decisions
Review code: GitHub repository
π Network and Privacy
Local Mode (Default)
Zero network calls:
- β All evaluation on your machine
- β Passport stored locally
- β Decisions stay local
- β Full privacy
- β Works offline
Perfect for: Development, personal use, air-gapped environments
API Mode (Optional)
Network usage:
- Tool name + context β APort API for policy evaluation
- Hosted passport fetched from registry (if using agent_id)
- Signed decisions returned (Ed25519 cryptographic signatures)
Benefits:
- β Cryptographically signed decisions
- β Court-admissible audit trail
- β Global suspend across all systems
- β Centralized compliance dashboards
- β No local passport tampering possible
API endpoint: https://api.aport.io (or custom via APORT_API_URL)
Data sent:
- Tool name (e.g., "system.command.execute")
- Context (e.g., {"command": "ls"})
- Passport (if local) or agent_id (if hosted)
Data NOT sent:
- File contents
- Environment variables
- API keys or credentials
- Unrelated system information
To verify: Use local mode (no network) or inspect open-source code.
βοΈ Environment Variables
| Variable | When Used | Purpose |
|---|---|---|
APORT_API_URL |
API mode | Override endpoint (default: https://api.aport.io). Use for self-hosted or custom API. |
APORT_AGENT_ID |
Hosted passport | Passport ID from aport.io. API fetches passport from registry. |
APORT_API_KEY |
If API requires auth | Authentication token. Set in environment (not config files). |
Local mode: No environment variables needed. Passport read from ~/.openclaw/aport/passport.json.
Hosted mode: Pass agent_id to installer or set APORT_AGENT_ID.
π§ Tool Name Mapping
| When agent calls⦠| Tool name | Policy |
|---|---|---|
| Shell commands | system.command.execute |
Allowlist, blocked patterns |
| WhatsApp/Email/Slack | messaging.message.send |
Rate limits, recipient allowlist |
| Create/merge PRs | git.create_pr, git.merge |
PR size, branch restrictions |
| MCP tools | mcp.tool.execute |
Server/tool allowlist |
| Data export | data.export |
Row limits, PII filtering |
| File read/write | data.file.read, data.file.write |
Path restrictions |
| Web requests | web.fetch, web.browser |
Domain allowlist, SSRF protection |
Context format: Valid JSON, e.g., '{"command":"ls"}' or '{"channel":"whatsapp","to":"+1..."}'
π Out-of-the-Box Protections
Shell commands (system.command.execute.v1):
- Allowlist enforcement (only specified commands run)
- 40+ blocked patterns:
rm -rf,sudo,chmod 777,dd if=,mkfs, etc. - Interpreter bypasses blocked:
python -c,node -e,base64encoding - Command injection patterns detected
Messaging (messaging.message.send.v1):
- Rate limits (msgs_per_min, msgs_per_day)
- Recipient allowlist
- Channel restrictions
File access (data.file.read/write.v1):
- Path restrictions (block /etc, /bin, system directories)
- Prevent .env, SSH key theft
Web requests (web.fetch/browser.v1):
- Domain allowlist
- SSRF protection (block private IPs)
- Rate limiting
Git operations (code.repository.merge.v1):
- PR size limits
- Branch restrictions
- Review requirements
All policies at: https://aport.io/policy-packs
π Security Model
What APort Protects
β Agent action security:
- Prompt injection (hook-based enforcement, not prompt-based)
- Malicious third-party skills
- Unauthorized commands
- Data exfiltration via files, messaging, web requests
- Resource exhaustion (rate/size limits)
Trust Model
APort operates at the application layer (between agent decision and tool execution).
You must trust:
- Your operating system (file permissions, process isolation)
- OpenClaw runtime (hooks execute correctly)
- APort code (open-source, verifiable)
Local mode additionally trusts:
- Filesystem integrity (passport not tampered)
API mode eliminates:
- Local passport tampering (fetched from API)
- Decision tampering (cryptographically signed)
Out of scope (OS/infrastructure security):
- File system compromise
- OpenClaw CVEs
- Network attacks (MITM, DNS poisoning)
- Supply chain attacks
This is standard for application-layer authorization (same model as OAuth, IAM, policy engines).
π― Use Cases
Protect against malicious skills:
- Install APort before adding community skills
- Every skill's tool calls are checked
- Malicious actions blocked before execution
Compliance and audit:
- Tamper-evident decision logs
- Court-admissible audit trail (API mode with Ed25519 signatures)
- SOC 2, HIPAA, SOX compliance support
Team deployments:
- Shared passport across systems (global suspend)
- Centralized policy updates
- Consistent enforcement
Air-gapped environments:
- Use local mode (zero network)
- All evaluation on-premise
- Self-hosted policy packs
π Documentation
APort Guardrails:
- QuickStart: OpenClaw Plugin
- Security Model & Trust Boundaries
- Hosted Passport Setup
- Tool/Policy Mapping
- Verification Methods (Local vs API)
OpenClaw:
Security:
- SECURITY.md - Prompt injection, Cisco findings
- OAP Specification - Open Agent Passport standard
π€ Support and Community
GitHub: aporthq/aport-agent-guardrails Website: aport.io Issues: GitHub Issues
Open-source: Apache 2.0 License Code review: All code publicly available for inspection
β FAQ
Q: Does this slow down my agent? A: Minimal overhead. API mode: ~60-100ms. Local mode: <300ms. Runs in parallel with agent thinking.
Q: Can I use this offline? A: Yes. Local mode works without network connectivity.
Q: What if I need custom policies? A: API mode: Pass custom policy JSON in request. Local mode: Edit bash script or use API mode.
Q: How do I suspend my agent? A: Local: Set passport status to "suspended". Hosted: Log in to aport.io and suspend (global effect).
Q: Is my data sent to APort? A: Local mode: No. API mode: Tool name + context only (no credentials, file contents, or env vars).
Q: Can the agent bypass this?
A: No. Enforcement is in the platform hook (before_tool_call), not controllable by prompts.
Q: What happens if APort errors?
A: Default: Tool blocked (fail-closed). Configurable via failClosed setting.
Made with π‘οΈ by APort Β· Open-source on GitHub Β· Apache 2.0 License