AIFeed

Airlock:为 AI 智能体提供带哈希链不可篡改账本的出口防火墙

Translation(model translation, not the source's own text)

仓库文件导航

题图
题图

Airlock 🔒

面向自主 AI Agent 的出口与 API 动作防火墙

Airlock 会拦截 AI Agent 尝试发起的每一次出站 API 调用——在调用真正发出之前,依据威胁规则引擎对其打分。被阻止和被隔离的动作会记录到防篡改的不可变账本中。未经放行,任何内容都无法流出。

旨在将威胁检测与不可变状态桥接为主动防御层。

为什么需要 Airlock

自主 Agent 做决策很快。太快了。如果没有防火墙层,配置出错的 Agent 可能会:

  • 通过未受保护的 API 调用外泄敏感数据
  • 触达本不该访问的内部端点
  • 发出无法撤销的 DELETE 请求
  • 在出站载荷中泄露凭据或令牌

Airlock 会在这一切发生之前将其阻止。

架构


        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
      

端点

方法路由说明
POST/intercept在动作发出前进行评估
POST/rollback对先前被放行的动作触发回滚
GET/ledger读取完整的不可变动作日志
GET/verify校验账本完整性(哈希链检查)
GET/health健康检查

快速开始


        git clone https://github.com/rcortez056-spec/airlock.git
cd airlock
node src/index.js
      

服务器在端口 3000 启动(可通过 PORT 环境变量配置)。

用法

拦截一个动作


        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 响应(200):


        {
  "allowed": true,
  "verdict": "ALLOW",
  "score": 0,
  "reasons": [],
  "ledger_id": "uuid-here",
  "timestamp": "2026-12-04T..."
}
      

BLOCK 响应(403):


        {
  "allowed": false,
  "verdict": "BLOCK",
  "score": 75,
  "reasons": ["Blocked endpoint pattern: /localhost/", "Endpoint failed format validation"],
  "ledger_id": "uuid-here",
  "timestamp": "2026-12-04T..."
}
      

触发回滚


        curl -X POST http://localhost:3000/rollback \
  -H "Content-Type: application/json" \
  -d '{ "ledger_id": "uuid-of-action", "reason": "Agent misfired" }'
      

校验账本完整性


        curl http://localhost:3000/verify
      

评分规则

触发条件增加分数
被阻止的 HTTP 方法(DELETE)+40
被阻止的端点(localhost、internal、AWS metadata)+50
载荷中的敏感字段(api_key、secret、token 等)每个 +20
请求头中的敏感字段每个 +15
端点未通过格式校验+25
  • BLOCK → 分数 ≥ 40
  • QUARANTINE → 分数 ≥ 25
  • ALLOW → 分数 < 25

不可变账本

每个被拦截的动作都会作为仅追加、哈希链式记录写入 ledger.jsonl。每条记录包括:

  • 唯一 ID 和时间戳
  • 前一条记录的哈希(防篡改链)
  • 判定结果、分数和原因
  • 动作元数据(method、endpoint、agent_id、载荷大小)

/verify 端点会检查整条链并报告任何篡改。

运行测试


        node src/test.js
      

全部 13 项测试通过。覆盖:安全动作、被阻止的方法、敏感载荷、内部端点、回滚和账本完整性。

技术栈

文章标题:Airlock —— 面向 AI agent 的出站防火墙,带哈希链式不可篡改账本

正文:

  • 运行时:Node.js(零依赖)
  • 存储:仅追加的 JSONL 账本
  • 完整性:SHA-256 哈希链
  • 传输:HTTP(部署在你现有基础设施之后)

连接

由 Ramon Cortez 构建 —— AI 系统架构师

属于自主防御技术栈的一部分,与以下项目并列:

  • GitBridge AI —— GitHub 事件自动化
  • Sentinel Guard Engine —— 执行前安全层
  • Email Threat Detector —— AI 分诊流水线

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗