Security Architecture
OpenFang’s security is built on multiple independent layers:16 Security Systems
WASM sandbox, Merkle audit trail, taint tracking, Ed25519 signing, SSRF protection, secret zeroization, and more
Defense in Depth
Multiple independent controls—no single point of failure
Zero Trust
Capability-based permissions, privilege escalation prevention, cryptographic verification
Audit Trail
Tamper-evident Merkle hash chain for all agent actions
API Authentication
Enable Bearer Token Authentication
Using the API Key
Localhost Bypass: Requests from
127.0.0.1 bypass authentication by default for local CLI usage. This can be disabled with api_require_auth_local = true.Network Security
Bind Address Configuration
OFP Peer Network
Secure peer-to-peer networking for agent collaboration:string
default:"127.0.0.1:4200"
OFP network listen address. Use
0.0.0.0 for public peer networking.Shared secret for HMAC-SHA256 mutual authentication. Must be identical across all peers in the network.
- HMAC-SHA256 mutual authentication
- Nonce-based replay protection
- Constant-time verification
- No plain-text credentials on wire
Rate Limiting
OpenFang uses GCRA (Generic Cell Rate Algorithm) for cost-aware rate limiting:Per-Channel Rate Limits
Role-Based Access Control (RBAC)
Multi-user support with role hierarchy:Role Capabilities
Capability-Based Permissions
Agents declare required tools, kernel enforces access:Privilege Escalation Prevention: Child agents spawned by an agent can never have more capabilities than their parent.
Secret Management
Environment Variables (Recommended)
Store all secrets in environment variables:Secret Zeroization
OpenFang automatically wipes secrets from memory:SSRF Protection
Server-Side Request Forgery prevention:- Private IP ranges (RFC 1918)
- Loopback addresses (127.0.0.0/8)
- Link-local addresses (169.254.0.0/16)
- Cloud metadata endpoints (AWS, GCP, Azure)
- DNS rebinding attacks
Path Traversal Prevention
All file operations use canonicalized paths:file_read: Cannot escape workspacefile_write: Cannot write outside allowed directoriesfile_delete: Cannot delete system files
Audit Trail
Tamper-evident Merkle hash chain:Verify Audit Integrity
- Agent creation/deletion
- Tool invocations
- File system access
- Network requests
- Model API calls
- Configuration changes
Prompt Injection Scanning
Skill content is scanned for injection attempts:- Override attempts (“Ignore previous instructions”)
- Data exfiltration (“Send system info to…”)
- Shell reference injection
- Base64-encoded payloads
WASM Sandbox
Tool code runs in WebAssembly with dual metering:Dual Metering: Fuel metering catches infinite loops, epoch interruption catches sleep/wait attacks. A watchdog thread forcibly kills runaway code.
Security Headers
HTTP security headers on all responses:Content-Security-PolicyX-Frame-Options: DENYX-Content-Type-Options: nosniffStrict-Transport-SecurityReferrer-Policy: strict-origin-when-cross-origin
Docker Sandbox (Optional)
Run code execution in isolated Docker containers:Production Security Checklist
1
Enable API Authentication
Set
api_key in config.toml with a strong random key (32+ characters)2
Configure Network Binding
Use
api_listen = "0.0.0.0:4200" with authentication, or 127.0.0.1:4200 for local-only3
Enable Rate Limiting
Set
api_rate_limit and per-channel rate_limit_per_user4
Configure RBAC
Define users with appropriate roles (owner/admin/user/viewer)
5
Enable Audit Logging
Set
audit.enabled = true and monitor audit trail6
Restrict File Access
Enable
strict_path_validation and disable allow_symlinks7
Configure SSRF Protection
Enable
block_private_ips and block_metadata_endpoints8
Use Environment Variables for Secrets
Never hardcode API keys in config files
9
Enable HTTPS (Reverse Proxy)
Use nginx/Caddy with TLS certificates in front of OpenFang
10
Regular Security Updates
Keep OpenFang updated:
openfang updateReverse Proxy (HTTPS)
Nginx Configuration
Caddy Configuration
Firewall Rules
Security Monitoring
Incident Response
Revoke Compromised API Key
Disable Compromised User
Security Reporting
Found a vulnerability? Report it responsibly:- Email: security@openfang.ai
- Do NOT open public GitHub issues for security issues
- Expect: Acknowledgment within 48 hours, fix within 14 days
Next Steps
Configuration Overview
Complete configuration guide
Deployment
Production deployment best practices