Repository files navigation
Airlock 🔒
Egress & API Action Firewall for Autonomous AI Agents
Airlock intercepts every outbound API call an AI agent attempts to make — scoring it against a threat rules engine before it fires. Blocked and quarantined actions are logged to a tamper-evident immutable ledger. Nothing gets out without clearance.
Built to bridge threat detection and immutable state into an active defense layer.
Why Airlock
Autonomous agents make decisions fast. Too fast. Without a firewall layer, a misconfigured agent can:
- Exfiltrate sensitive data through an unguarded API call
- Hit internal endpoints it was never meant to reach
- Fire DELETE requests that can't be undone
- Leak credentials or tokens in outbound payloads
Airlock stops all of that — before it happens.
Architecture
Agent Action Request
│
▼
┌───────────────────┐
│ Airlock Server │ POST /intercept
│ │
│ ┌─────────────┐ │
│ │ Rules Engine │ │ Scores: method, endpoint, payload, headers
│ └──────┬──────┘ │
│ │ │
│ ┌──────▼──────┐ │
│ │ Verdict │ │ ALLOW / QUARANTINE / BLOCK
│ └──────┬──────┘ │
│ │ │
│ ┌──────▼──────┐ │
│ │ Ledger │ │ Append-only, hash-chained, tamper-evident
│ └─────────────┘ │
└───────────────────┘
│
▼
200 ALLOW or 403 BLOCK
Endpoints
| Method | Route | Description |
|---|---|---|
| POST | /intercept | Evaluate an action before it fires |
| POST | /rollback | Trigger rollback on a previously allowed action |
| GET | /ledger | Read the full immutable action log |
| GET | /verify | Verify ledger integrity (hash chain check) |
| GET | /health | Health check |
Quickstart
git clone https://github.com/rcortez056-spec/airlock.git
cd airlock
node src/index.js
Server starts on port 3000 (configurable via PORT env var).
Usage
Intercept an action
curl -X POST http://localhost:3000/intercept \
-H "Content-Type: application/json" \
-d '{
"method": "POST",
"endpoint": "https://api.example.com/submit",
"payload": { "data": "clean payload" },
"agent_id": "my-agent",
"source": "relevance-ai"
}'
ALLOW response (200):
{
"allowed": true,
"verdict": "ALLOW",
"score": 0,
"reasons": [],
"ledger_id": "uuid-here",
"timestamp": "2026-12-04T..."
}
BLOCK response (403):
{
"allowed": false,
"verdict": "BLOCK",
"score": 75,
"reasons": ["Blocked endpoint pattern: /localhost/", "Endpoint failed format validation"],
"ledger_id": "uuid-here",
"timestamp": "2026-12-04T..."
}
Trigger a rollback
curl -X POST http://localhost:3000/rollback \
-H "Content-Type: application/json" \
-d '{ "ledger_id": "uuid-of-action", "reason": "Agent misfired" }'
Verify ledger integrity
curl http://localhost:3000/verify
Scoring Rules
| Trigger | Score Added |
|---|---|
| Blocked HTTP method (DELETE) | +40 |
| Blocked endpoint (localhost, internal, AWS metadata) | +50 |
| Sensitive field in payload (api_key, secret, token, etc.) | +20 each |
| Sensitive field in headers | +15 each |
| Endpoint fails format validation | +25 |
- BLOCK → score ≥ 40
- QUARANTINE → score ≥ 25
- ALLOW → score < 25
Immutable Ledger
Every intercepted action is logged to ledger.jsonl as an append-only, hash-chained record. Each entry includes:
- Unique ID and timestamp
- Hash of the previous entry (tamper-evident chain)
- Verdict, score, and reasons
- Action metadata (method, endpoint, agent_id, payload size)
The /verify endpoint checks the full chain and reports any tampering.
Run Tests
node src/test.js
All 13 tests pass. Covers: safe actions, blocked methods, sensitive payloads, internal endpoints, rollback, and ledger integrity.
Stack
- Runtime: Node.js (zero dependencies)
- Storage: Append-only JSONL ledger
- Integrity: SHA-256 hash chain
- Transport: HTTP (deploy behind your existing infrastructure)
Connect
Built by Ramon Cortez — AI Systems Architect
Part of the autonomous defense stack alongside:
- GitBridge AI — GitHub event automation
- Sentinel Guard Engine — pre-execution safety layer
- Email Threat Detector — AI triage pipeline