bartelmost/agentshield

GitHub: bartelmost/agentshield

AgentShield 是一个 AI Agent 安全审计框架,通过自动化安全测试和签发加密身份证书来解决多 Agent 互联场景下的信任与安全问题。

Stars: 0 | Forks: 0

# AgentShield 审计 - ClawHub 技能 🔒 **审计 AI agent 的安全性,并获取用于 agent 间通信的可验证信任证书。** ![AgentShield](https://img.shields.io/badge/AgentShield-Security%20Audit-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Python](https://img.shields.io/badge/python-3.8+-blue) ![OpenClaw](https://img.shields.io/badge/OpenClaw-✓-brightgreen) ![Hermes](https://img.shields.io/badge/Hermes_Agent-✓-brightgreen) ## 什么是 AgentShield? AgentShield 是一个用于 AI agent 的**安全审计框架**。它会针对常见的攻击向量对你的 agent 进行测试,生成加密身份证书,并通过可验证的信任链实现安全的 agent 间通信。 **可以将其理解为:** AI Agent 的 Let's Encrypt 🛡️ ## 🌐 框架兼容性 开箱即用地兼容主流开源 agent 框架: | 框架 | 自动检测 | 安装 | |-----------|---------------|--------| | **OpenClaw** | ✅ 检测 `IDENTITY.md` | `clawhub install agentshield-audit` | | **Hermes Agent** | ✅ 检测 `~/.hermes/` | `clawhub install agentshield-audit` | | **n8n** | ✅ 检测 `~/.n8n/` | `clawhub install agentshield-audit` | | **LangChain / 自定义** | 手动 `--name`/`--platform` | `clawhub install agentshield-audit` | OpenClaw 和 Hermes 均使用 [agentskills.io](https://agentskills.io) 开放标准 —— 相同的安装命令,相同的工作流。 → [Hermes 集成指南](HERMES.md) ## 🚀 快速开始 ### 安装 ``` clawhub install agentshield-audit ``` ### 运行你的首次审计 ``` cd ~/.openclaw/workspace/skills/agentshield-audit python initiate_audit.py --auto ``` 就这样!你的 agent 将在大约 30 秒内完成审计,并获得一个签名证书。 ## ✨ 功能特性 - ✅ **零外部拉取** - 所有脚本均本地内置 - ✅ **Human-in-the-loop** - 读取文件前需要明确的批准 - ✅ **加密身份** - 生成 Ed25519 密钥对,私钥在本地存储 - ✅ **安全审计** - 针对 5 种以上的常见攻击向量进行测试 - ✅ **可验证证书** - 有效期 90 天,由 AgentShield CA 签名 - ✅ **对等节点验证** - 在信任其他 agent 之前验证其证书 - ✅ **无需 API key** - 基础使用免费(限制:每小时 1 次审计) - ✅ **隐私优先** - 私钥绝对不会离开你的工作区 ## 🧪 测试内容是什么? 你的 agent 将接受以下攻击向量的测试: | 测试 | 描述 | 风险等级 | |------|-------------|------------| | **System Prompt 窃取** | 尝试提取 agent 的 system prompt | 高 | | **指令覆盖** | 尝试覆盖安全指令 | 严重 | | **工具权限检查** | 验证工具访问控制是否得当 | 高 | | **记忆隔离** | 测试会话之间是否存在上下文泄露 | 中 | | **机密信息泄露** | 扫描暴露的 API key、token、密码 | 严重 | **你的安全评分:** 基于通过的测试给出 0-100 的分数 ## 📦 包含内容 ``` agentshield-audit/ ├── SKILL.md # Complete skill documentation ├── README.md # This file ├── HERMES.md # Hermes Agent integration guide ├── clawhub.json # ClawHub manifest ├── requirements.txt # Python dependencies ├── sandbox_config.yaml # Tool sandbox configuration ├── CHANGELOG.md # Version history ├── INSTALLATION.md # Detailed installation guide ├── QUICKSTART.md # Step-by-step tutorial │ ├── Core Audit Scripts: │ ├── initiate_audit.py # Main script - start new audit with consent │ ├── verify_peer.py # Verify another agent's certificate │ ├── show_certificate.py # Display your certificate │ └── audit_client.py # Low-level API client │ ├── Security Modules: │ ├── input_sanitizer.py # Input validation │ ├── output_dlp.py # Output data loss prevention │ ├── tool_sandbox.py # Tool execution sandbox │ ├── echoleak_test.py # Echo leakage detection │ ├── secret_scanner.py # Secret scanning │ └── supply_chain_scanner.py # Supply chain security │ └── Setup: ├── setup.py # Package setup script ├── __init__.py # Module init └── verify_bundle.py # Bundle verification ``` **所有脚本均在本地内置** - 无需拉取外部代码。 ## 🔐 Human-in-the-Loop 授权 在访问任何敏感文件(`IDENTITY.md`、`SOUL.md`、system prompt)之前,AgentShield 会**明确要求用户批准**: ``` Before proceeding, I need to: 1. Read these files (to detect agent name): • IDENTITY.md • SOUL.md 2. Generate a cryptographic keypair (stored locally in ~/.agentshield/) 3. Send public key to AgentShield API Proceed? [y/N]: ``` **用户必须明确输入 'y' 或 'yes' 才能继续。** ### 跳过文件读取 为了避免任何文件访问,可以手动提供信息: ``` python initiate_audit.py --name "MyAgent" --platform telegram ``` ## 🔐 隐私与安全 ### 本地存储了什么内容? 所有敏感数据都保存在 `~/.openclaw/workspace/.agentshield/` 中: ``` .agentshield/ ├── agent.key # Your Ed25519 private key (NEVER shared) ├── certificate.json # Your signed certificate (shareable) └── config.json # Agent configuration ``` **文件权限:** 私钥以 `600` 权限存储(仅所有者可读写) ### 哪些数据会发送到 AgentShield API? 1. **公钥**(Ed25519,根据你的私钥生成) 2. **Agent 名称**(自动检测或由用户指定) 3. **平台**(discord、telegram 等) 4. **审计结果**(测试分数,无敏感数据) **绝对不发送的数据:** - ❌ 私钥 - ❌ API token - ❌ System prompt - ❌ 对话历史 - ❌ 用户数据 ### 频率限制 - **免费层级:** 每个 IP 每小时 1 次审计 - **无需注册** - **基础使用无需付费** - 企业/大容量需求:请联系我们 ## 🎯 使用示例 ### 1. 自动检测审计(推荐) ``` python initiate_audit.py --auto ``` 该脚本将执行以下操作: - 在读取文件前请求明确的用户授权 - 从 `IDENTITY.md`、`SOUL.md` 自动检测你的 agent 名称 - 从环境变量自动检测平台 - 如果不存在 Ed25519 密钥对则生成 - 运行安全审计 - 保存你的证书 ### 2. 手动审计(指定名称和平台) ``` python initiate_audit.py --name "MyAgent" --platform telegram ``` 无需访问文件 - 完全手动操作。 ### 3. 验证其他 Agent ``` python verify_peer.py --agent-id "agent_abc123xyz" ``` 返回内容: - ✅ 证书有效性 - ✅ 过期日期 - ✅ 安全评分 - ✅ 公钥指纹 ### 4. 显示你的证书 ``` python show_certificate.py ``` 显示内容: - Agent ID - 有效期 - 安全评分 - 验证 URL ## 📚 文档 - **[SKILL.md](SKILL.md)** - 包含 Human-in-the-Loop 详情的完整技能参考 - **[QUICKSTART.md](QUICKSTART.md)** - 面向首次用户的分步教程 - **[INSTALLATION.md](INSTALLATION.md)** - 详细的安装说明 - **[GitHub](https://github.com/bartelmost/agentshield)** - 源代码与 issues ## 🛠️ 安装要求 - **Python:** 3.8 或更高版本 - **依赖项:** - `cryptography>=41.0.0`(Ed25519 密钥生成) - `requests>=2.31.0`(API 通信) 安装依赖项: ``` pip install -r requirements.txt ``` ## 🔧 故障排除 ### "No certificate found"(未找到证书) **解决方案:** 运行 `python initiate_audit.py --auto` 生成一个 ### "Challenge failed"(挑战失败) **解决方案:** 检查你的系统时钟。AgentShield 使用基于时间的挑战-响应身份验证(需要 NTP 同步) ### "API unreachable"(无法访问 API) **解决方案:** 检查网络连接。API endpoint 为 `https://agentshield.live/api` ### "Rate limited"(触发频率限制) **解决方案:** 免费层级允许每小时进行 1 次审计。两次审计之间请等待 60 分钟。 ### "Auto-detection failed"(自动检测失败) **解决方案:** 使用手动模式: ``` python initiate_audit.py --name "YourAgentName" --platform discord ``` ## 🧑‍💻 开发 所有脚本均在本地内置。无需外部下载。 ### 安全模块结构 ``` # Security 测试是模块化的——每个测试都可以独立导入 from input_sanitizer import sanitize_input from secret_scanner import scan_for_secrets from output_dlp import check_output ``` ## 📄 许可证 MIT License ## 💬 支持 - **Issues:** https://github.com/bartelmost/agentshield/issues - **联系:** Moltbook 上的 @Kalle-OC - **文档:** https://github.com/bartelmost/agentshield ## 🌟 为什么选择 AgentShield? 随着 AI agent 变得越来越自主和互联,**信任成为了瓶颈**。AgentShield 通过以下方式解决此问题: 1. **标准化安全审计** - 对所有 agent 进行一致的测试 2. **实现可验证信任** - 任何人都可以验证的加密证书 3. **防范攻击向量** - 针对已知威胁进行主动防御 4. **构建信任网络** - Agent 在协作之前可以相互验证 **保护自身安全。验证他人。默认不信任任何事物。** 🛡️ **由 AgentShield 团队使用 🔐 精心制作**
标签:AI安全, AI智能体, Chat Copilot, DNS 反向解析, StruQ, 后端开发, 密码学, 手动系统调用, 逆向工具