topazyo/openclaw-security-playbook

GitHub: topazyo/openclaw-security-playbook

面向生产环境的AI代理全方位安全剧本,提供七层防御架构以解决凭据泄露、身份绕过及提示注入等核心安全威胁。

Stars: 2 | Forks: 0

# OpenClaw 安全剧本 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![文档](https://img.shields.io/badge/docs-complete-brightgreen.svg)](docs/guides/) [![安全: 加固](https://img.shields.io/badge/security-hardened-blue.svg)](docs/guides/01-quick-start.md) [![平台: 多平台](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey.svg)](docs/guides/) [![SOC 2 Type II](https://img.shields.io/badge/SOC%202-100%25%20compliant-green.svg)](configs/organization-policies/soc2-compliance-mapping.json) [![ISO 27001:2022](https://img.shields.io/badge/ISO%2027001-100%25%20compliant-green.svg)](configs/organization-policies/iso27001-compliance-mapping.json) [![GDPR](https://img.shields.io/badge/GDPR-compliant-green.svg)](docs/policies/data-classification-policy.md) [![测试](https://img.shields.io/badge/tests-9%20suites%20passing-brightgreen.svg)](tests/) [![CI](https://img.shields.io/badge/CI-GitHub%20Actions-blue.svg)](.github/workflows/) ## 🚨 问题所在 像 OpenClaw/ClawdBot 这样的 AI 代理面临着严重的安全漏洞: - **90% 的凭据泄露率**,归因于明文配置文件和备份文件的持久化 - **本地主机身份验证绕过**,通过 SSH 隧道和反向代理实现 - **供应链攻击**,通过恶意技能安装进行 - **提示注入**,导致未经授权的工具执行 **现实影响:** 2023-2024 年的研究中发现了 1200+ 个暴露的实例。 ## ✅ 解决方案 本剧本提供了 **7 层深度防御** 安全架构: ``` ┌─────────────────────────────────────────────────────────────┐ │ Layer 7: Organizational Controls │ │ • Shadow AI detection • Governance • Compliance │ ├─────────────────────────────────────────────────────────────┤ │ Layer 6: Behavioral Monitoring │ │ • Anomaly detection • Alerting • openclaw-telemetry │ ├─────────────────────────────────────────────────────────────┤ │ Layer 5: Supply Chain Security │ │ • Skill integrity • GPG verification • Allowlists │ ├─────────────────────────────────────────────────────────────┤ │ Layer 4: Runtime Security Enforcement │ │ • Prompt injection guards • PII redaction • openclaw-shield│ ├─────────────────────────────────────────────────────────────┤ │ Layer 3: Runtime Sandboxing │ │ • Docker security • Read-only FS • Capability dropping │ ├─────────────────────────────────────────────────────────────┤ │ Layer 2: Network Segmentation │ │ • VPN-only access • Firewall rules • Rate limiting │ ├─────────────────────────────────────────────────────────────┤ │ Layer 1: Credential Isolation (OS-Level) │ │ • OS keychain • No plaintext • Backup file prevention │ └─────────────────────────────────────────────────────────────┘ ``` **结果:** 当所有层都部署时,零成功攻击。 ## 📦 包含内容 本剧本为 AI 代理提供了一个 **全面、生产就绪的安全框架**,包含 110+ 个文件和完整的场景到检测覆盖: ### 📚 文档与威胁建模 - **指南与检查清单:** 完整的实施指南、入职培训、安全审查和生产检查清单(见 `docs/guides/`、`docs/checklists/`) - **策略与程序:** 数据分类、漏洞管理、访问控制、事件响应和运营策略(`docs/policies/`、`docs/procedures/`、`configs/organization-policies/`) - **威胁模型:** MITRE ATLAS 映射、杀伤链和场景交叉引用(`docs/threat-model/`) ### 💻 实施示例与场景 - **安全控制:** 用于身份验证、输入验证、加密、日志记录、速率限制、备份验证和漏洞扫描的 Python 实现(`examples/security-controls/`) - **事件响应:** 针对凭据盗窃、数据泄露、DoS、提示注入、技能受损和报告模板的剧本(`examples/incident-response/`) - **监控:** Grafana 仪表盘、Prometheus/Alertmanager 配置、告警规则以及高管/IR 仪表盘(`examples/monitoring/`、`configs/monitoring-config/`) - **攻击场景:** 七个映射的对抗场景,包含重放和检测验证(`examples/scenarios/`) ### 🔍 检测规则与覆盖 - **Sigma 规则:** 12+ 条平台无关规则,涵盖凭据窃取、网关暴露、技能子进程、SOUL.md 修改、供应链偏移、TLS 降级、冒充、路径遍历、RAG 投毒等(`detections/sigma/`) - **KQL (MDE):** 针对 Microsoft Defender for Endpoint 的发现、行为狩猎和杀伤链检测(`detections/edr/mde/`) - **Splunk SPL:** 发现和行为狩猎查询(`detections/siem/splunk/`) - **YARA/IOC:** 凭据外泄、恶意技能、SOUL.md 注入的指标(`detections/ioc/`) - **重放验证:** 针对托管和本地运行器的检测重放和回归工作流(`.github/workflows/detection-replay-validation.yml`) ### 🤖 自动化脚本与工具 - **发现与验证:** 操作系统漏洞扫描、依赖检查、IoC 扫描、安全态势评估(`scripts/discovery/`、`scripts/verification/`) - **事件响应:** 自动遏制、取证收集、通知、工单生成、时间线构建(`scripts/incident-response/`、`scripts/forensics/`) - **供应链:** 技能完整性监控、清单验证(`scripts/supply-chain/`) - **运营工具:** CLI、策略验证器、事件模拟器、合规报告器、证书管理器、配置迁移工具(`tools/`) ### ⚙️ 配置与策略文件 - **代理配置:** 加固的代理配置,包含环境覆盖(`configs/agent-config/`) - **MCP Server:** TLS 1.3+、mTLS、OAuth2、防火墙规则(`configs/mcp-server-config/`) - **监控:** Prometheus、Grafana 数据源、Alertmanager 路由(`configs/monitoring-config/`) - **技能策略:** 允许列表、危险模式、强制执行、清单 Schema(`configs/skill-policies/`) - **模板:** 凭据、网关、nginx 的安全默认值(`configs/templates/`) ### ✅ 测试框架 - **单元测试:** 身份验证、加密、输入验证、速率限制、CLI 冒烟测试(`tests/unit/`) - **集成测试:** 剧本程序、备份/恢复、访问审查(`tests/integration/`) - **安全测试:** 检测重放、证据快照、恶意技能链、策略合规性、运行时回归、漏洞扫描(`tests/security/`) - **测试夹具:** 对抗性和规避测试用例(`tests/security/fixtures/`) ### 🎓 培训材料 - **安全培训:** 4 小时安全团队课程(架构、运营、IR、监控)(`training/security-training.md`) - **开发者指南:** 2 小时入职培训,涵盖集成、测试、故障排除(`training/developer-guide.md`) ### 🤖 CI/CD 工作流 - **安全扫描:** Trivy、Bandit、npm audit、pip-audit、Gitleaks、SBOM(`.github/workflows/security-scan.yml`) - **合规检查:** 策略验证、YAML linting、安全测试、合规报告(`.github/workflows/compliance-check.yml`) - **运行时回归:** 托管运行器验证和制品归档(`.github/workflows/runtime-security-regression.yml`) - **检测重放:** 对抗性重放和规避验证(`.github/workflows/detection-replay-validation.yml`) **总计:110+ 个文件,提供企业级、场景完备的 AI 代理安全** ## 🚀 快速开始(15 分钟) 在 15 分钟内让一个加固的 AI 代理运行起来: ``` # 克隆仓库 git clone https://github.com/YOUR-ORG/clawdbot-security-playbook.git cd clawdbot-security-playbook # 安装依赖 pip install -r requirements.txt # 运行安全验证(预检查) ./scripts/verification/verify_openclaw_security.sh # 验证配置 openclaw-cli config validate configs/agent-config/openclaw-agent.yml # 扫描漏洞 openclaw-cli scan vulnerability --target production # 使用 Docker 部署(加固) docker run -d \ ``` ## 🎓 学习路径 ### 面向开发者(安全新手) **目标:** 理解并实施基本安全措施 1. **从这里开始:** [快速开始指南](docs/guides/01-quick-start.md)(15 分钟) 2. **学习:** [凭据隔离](docs/guides/02-credential-isolation.md)(30 分钟) 3. **实践:** 使用 `docker-compose-full-stack.yml` 部署 4. **验证:** 运行 `verify_openclaw_security.sh` **时间投入:** 2 小时 → 安全部署 ### 面向安全工程师 **目标:** 实施完整的深度防御 **第 1 周:** - 第 1-2 天:第 1-3 层(凭据、网络、沙箱) - 第 3 天:第 4 层(运行时强制执行 - openclaw-shield) - 第 4 天:第 5 层(供应链安全) - 第 5 天:部署监控栈 **第 2 周:** - 第 1-2 天:第 6 层(行为监控 - openclaw-telemetry) - 第 3 天:事件响应规划 - 第 4-5 天:测试和验证 **时间投入:** 2 周 → 企业级安全 ### 面向 DevOps/SRE **目标:** 具备可观测性的生产部署 1. **基础设施:** 部署 [production-k8s.yml](configs/examples/production-k8s.yml)(2 小时) 2. **监控:** 配置 [monitoring-stack.yml](configs/examples/monitoring-stack.yml)(1 小时) 3. **自动化:** 设置 [backup-restore.sh](configs/examples/backup-restore.sh)(30 分钟) 4. **运行手册:** 审查 [事件响应](docs/guides/06-incident-response.md)(1 小时) **时间投入:** 4-5 小时 → 生产就绪部署 ### 面向安全研究人员 **目标:** 理解攻击向量和缓解措施 **推荐阅读顺序:** 1. [供应链安全](docs/guides/05-supply-chain-security.md) - 恶意技能 2. [网络分段](docs/guides/03-network-segmentation.md) - 身份验证绕过 3. [凭据隔离](docs/guides/02-credential-isolation.md) - 备份文件持久化 4. [社区工具](docs/guides/07-community-tools-integration.md) - 检测技术 5. [检测与狩猎](docs/guides/07-detection-and-hunting.md) - 3 层检测、杀伤链查询 6. [ATLAS 威胁映射](docs/threat-model/ATLAS-mapping.md) - MITRE ATLAS 杀伤链 **重点关注领域:** - 提示注入攻击向量 - 通过外部数据的间接提示注入 - 供应链攻击场景 - 容器逃逸尝试 - MITRE ATLAS 杀伤链映射(记录了 5 条链) - 检测规则编写(Sigma、KQL、SPL) ### 面向 SOC / 检测工程师 **目标:** 部署检测规则并构建狩猎工作流 1. **从这里开始:** [检测与狩猎指南](docs/guides/07-detection-and-hunting.md)(60 分钟) 2. **部署第 1 层:** 从 `detections/edr/` 为您的 EDR 平台导入发现查询 3. **转换 Sigma 规则:** `sigma convert -t detections/sigma/openclaw-*.yml` 4. **部署第 2-3 层:** 在 openclaw-telemetry 运行后,导入行为狩猎和杀伤链查询 5. **取证工具包:** 审查 `scripts/forensics/` 以进行证据收集和时间线构建 6. **威胁映射:** [ATLAS 映射](docs/threat-model/ATLAS-mapping.md) 用于杀伤链分类 **时间投入:** 2-3 小时 → 完整检测覆盖 ## 🏗️ 架构概览 ### 深度防御层级 ``` ┌─────────────────┐ │ AI Agent │ │ (ClawdBot) │ └────────┬────────┘ │ ┌────────▼────────┐ │ Layer 4 │ ┌──────────────┤ Shield Guard ├────────────┐ │ │ (Prompt Guard) │ │ │ └─────────────────┘ │ │ │ ┌────▼─────┐ ┌──────────────┐ ┌────────────────▼───┐ │ Layer 5 │ │ Layer 3 │ │ Layer 6 │ │ Supply │ │ Sandbox │ │ Telemetry │ │ Chain │ │ (Docker) │ │ (Monitoring) │ └────┬─────┘ └──────┬───────┘ └────────────────┬───┘ │ │ │ │ ┌──────▼───────┐ │ └─────────┤ Layer 2 ├────────────────────┘ │ Network │ │ (VPN/FW) │ └──────┬───────┘ │ ┌──────▼───────┐ │ Layer 1 │ │ OS Keychain │ └──────────────┘ ``` ### 数据流安全 ``` External Request │ ▼ ┌─────────────────────────────────────┐ │ 1. Network Layer (Layer 2) │ │ • VPN authentication │ │ • Firewall filtering │ │ • Rate limiting │ └─────────────┬───────────────────────┘ │ ✅ Authorized ▼ ┌─────────────────────────────────────┐ │ 2. Gateway Authentication │ │ • Token verification │ │ • IP allowlisting │ └─────────────┬───────────────────────┘ │ ✅ Authenticated ▼ ┌─────────────────────────────────────┐ │ 3. Input Sanitization (Layer 4) │ │ • Prompt injection detection │ │ • Delimiter stripping │ │ • Pattern matching │ └─────────────┬───────────────────────┘ │ ✅ Clean ▼ ┌─────────────────────────────────────┐ │ 4. AI Agent Processing │ │ • Skill execution (Layer 5 check) │ │ • Tool invocation (Layer 3 sandbox)│ │ • Credential access (Layer 1) │ └─────────────┬───────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ 5. Output Scanning (Layer 4) │ │ • PII/secret redaction │ │ • Credential filtering │ └─────────────┬───────────────────────┘ │ ✅ Safe ▼ ┌─────────────────────────────────────┐ │ 6. Monitoring & Logging (Layer 6) │ │ • Behavioral analysis │ │ • Anomaly detection │ │ • Audit trail │ └─────────────────────────────────────┘ ``` ## 🛡️ 安全特性 ### ✅ 凭据保护 - **操作系统密钥环集成:** macOS Keychain、Linux Secret Service、Windows Credential Manager - **零明文:** 配置文件、环境变量或日志中无凭据 - **备份文件预防:** 自动检测和清理编辑器备份文件 - **轮换支持:** 紧急凭据轮换的书面程序 ### ✅ 网络安全 - **仅限本地主机绑定:** 网关从不暴露于公共互联网 - **基于 VPN 的访问:** Tailscale、WireGuard 或 OpenVPN 集成 - **反向代理加固:** mTLS、速率限制、IP 白名单 - **防火墙配置:** UFW、iptables、pf 规则集示例 ### ✅ 容器安全 - **非 Root 用户:** 所有容器以 UID 1000+ 运行 - **只读文件系统:** 根文件系统以只读方式挂载 - **能力丢弃:** 仅在需要时保留 NET_BIND_SERVICE 能力 - **资源限制:** CPU、内存、进程和磁盘 I/O 限制 - **Seccomp/AppArmor:** 系统调用过滤和强制访问控制 ### ✅ 供应链安全 - **加密验证:** 对所有技能进行 GPG 签名检查 - **完整性清单:** 所有技能文件的 SHA256 校验和 - **自动化监控:** 每日完整性检查并告警 - **允许列表强制执行:** 只能安装经批准的技能 ### ✅ 运行时保护 - **提示注入防护:** 模式匹配和清理(openclaw-shield) - **PII 脱敏:** 自动从输出中移除敏感数据 - **工具允许列表:** 限制可执行的工具 - **行为监控:** 异常代理行为的异常检测(openclaw-telemetry) ### ✅ 检测与狩猎 - **3 层检测模型:** 发现 → 行为狩猎 → 杀伤链检测 - **平台覆盖:** Sigma(平台无关)、MDE KQL、Splunk SPL、YARA - **5 条杀伤链检测:** 提示注入到 RCE、数据盗窃、恶意技能分阶段 Payload、令牌盗窃 - **MITRE ATLAS 映射:** 完整分类法,包含 OWASP LLM 和 NIST CSF 交叉引用 ### ✅ 事件响应与取证 - **4 个响应剧本:** 凭据外泄、提示注入、未经授权访问、恶意技能 - **证据收集:** 自动取证和监管链(`collect_evidence.sh`) - **攻击时间线:** 带风险评分事件的时间顺序重建(`build_timeline.sh`) - **哈希链验证:** openclaw-telemetry 日志的篡改检测(`verify_hash_chain.py`) - **凭据范围界定:** 事件后凭据暴露评估(`check_credential_scope.sh`) - **沟通模板:** 预先编写的利益相关者通知 - **事件后审查:** 结构化的 PIR 流程和行动项 ## 🛠️ 运营工具与 CLI ### 运营脚本 | 脚本 | 用途 | 示例命令 | |--------|---------|-------| | **[verify_openclaw_security.sh](scripts/verification/verify_openclaw_security.sh)** | 安全态势验证 | `./verify_openclaw_security.sh` | | **[skill_manifest.py](scripts/supply-chain/skill_manifest.py)** | 技能完整性检查 | `python skill_manifest.py --skills-dir ~/.openclaw/skills` | | **[backup-restore.sh](configs/examples/backup-restore.sh)** | 备份和恢复 | `./backup-restore.sh backup` | | **[collect_evidence.sh](scripts/forensics/collect_evidence.sh)** | 事件证据保存 | `./collect_evidence.sh [--containment]` | | **[build_timeline.sh](scripts/forensics/build_timeline.sh)** | 攻击时间线重建 | `./build_timeline.sh --incident-dir ~/openclaw-incident-*` | | **[check_credential_scope.sh](scripts/forensics/check_credential_scope.sh)** | 凭据暴露评估 | `./check_credential_scope.sh [YYYY-MM-DD]` | | **[verify_hash_chain.py](scripts/forensics/verify_hash_chain.py)** | 遥测篡改检测 | `python verify_hash_chain.py --input telemetry.jsonl` | ### openclaw-cli 命令行工具 该框架包含一个用于日常安全操作的综合性 CLI: ``` # 漏洞扫描 openclaw-cli scan vulnerability --target production openclaw-cli scan compliance --policy SEC-003 openclaw-cli scan access --days 90 # 事件响应 openclaw-cli playbook list openclaw-cli playbook execute IRP-001 --severity P0 openclaw-cli simulate incident --type credential-theft --severity P1 # 合规性报告 openclaw-cli report weekly --start 2024-01-15 --end 2024-01-22 openclaw-cli report compliance --framework SOC2 --output report.json # 配置管理 openclaw-cli config validate openclaw-agent.yml openclaw-cli config migrate --from-version 1.0 --to-version 2.0 ``` ### Python 安全工具 ``` # 策略验证 (SEC-002/003/004/005) python tools/policy-validator.py --policy SEC-002 # 事件模拟 python tools/incident-simulator.py --type credential-theft # 合规性报告 python tools/compliance-reporter.py --framework SOC2 # 证书管理 python tools/certificate-manager.py # 配置迁移 python tools/config-migrator.py --config openclaw-agent.yml ``` ### 测试框架 包含 9 个测试文件的综合测试套件: ``` # 单元测试(4 个文件 - 安全控制) pytest tests/unit/test_input_validation.py # XSS/SQL/path traversal pytest tests/unit/test_rate_limiting.py # Token bucket, Redis pytest tests/unit/test_authentication.py # mTLS, OAuth2, MFA pytest tests/unit/test_encryption.py # AES-256-GCM, key rotation # 集成测试(3 个文件 - 工作流) pytest tests/integration/test_playbook_procedures.py # IRP-001 execution pytest tests/integration/test_backup_recovery.py # RTO/RPO validation pytest tests/integration/test_access_review.py # Quarterly reviews # 安全测试(2 个文件 - 合规性) pytest tests/security/test_policy_compliance.py # SEC-002/003/004/005 pytest tests/security/test_vulnerability_scanning.py # Trivy/npm/pip audits # 运行所有测试并生成覆盖率报告 pytest --cov=scripts --cov=examples --cov-report=html ``` ## 📊 指标与合规 ### 安全改进 | 指标 | 剧本实施前 | 剧本实施后 | 改进 | |--------|----------------|----------------|-------------| | **凭据暴露风险** | 90%(明文文件) | 0%(操作系统密钥环) | ✅ **100%** | | **网络攻击面** | 高(0.0.0.0 绑定) | 低(本地主机 + VPN) | ✅ **95%** | | **容器逃逸风险** | 高(Root,可写 FS) | 极低(非 Root,只读) | ✅ **90%** | | **供应链完整性** | 无(自动安装) | 高(签名、清单) | ✅ **100%** | | **事件响应时间** | 未知 | < 15 分钟(书面剧本) | ✅ **已定义** | | **漏洞修补** | 手动 | 自动化(CRITICAL <7d,HIGH <30d) | ✅ **自动化** | | **合规覆盖** | 0% | 100%(SOC 2、ISO 27001、GDPR) | ✅ **100%** | ### 合规映射 本剧本提供完整的合规覆盖: #### SOC 2 Type II(36 项控制 - 100% 已实施) - **CC6.1:** 逻辑和物理访问控制(需要 MFA) - **CC7.1:** 威胁识别程序(漏洞扫描) - **CC7.2:** 持续监控(Prometheus/Grafana/Alertmanager) - **CC7.3:** 事件响应(IRP-001 至 IRP-006 剧本) - **CC7.4:** 安全意识培训(security-training.md) - **CC8.1:** 变更管理程序(developer-guide.md) **可用证据:** - `configs/organization-policies/soc2-compliance-mapping.json`(36 项控制) - `openclaw-cli report compliance --framework SOC2`(自动报告) #### ISO 27001:2022(93 项控制 - 100% 已实施) - **A.9.2.1:** 用户注册和注销(访问审查) - **A.10.1.1:** 加密密钥管理(90 天轮换) - **A.12.6.1:** 技术漏洞管理(auto-remediate.sh) - **A.13.1.1:** 网络安全(VPN、防火墙、mTLS) - **A.16.1.5:** 信息安全事件响应(剧本) - **A.18.1.3:** 记录保护(7 年审计日志保留) **可用证据:** - `configs/organization-policies/iso27001-compliance-mapping.json`(93 项控制) - `openclaw-cli report compliance --framework ISO27001`(自动报告) #### GDPR(第 32 条 - 合规) - **加密:** 用于个人数据的 AES-256-GCM(data-classification-policy.md) - **访问控制:** MFA + RBAC(authentication.yml) - **泄露通知:** 自动 72 小时通知(notification-manager.py) - **数据最小化:** PII 检测和脱敏(input-validation.py) - **被遗忘权:** 书面删除程序 **可用证据:** - `docs/policies/data-classification-policy.md`(GDPR 要求) - `openclaw-cli scan compliance --policy SEC-002`(加密验证) ## 🚨 事件响应 ### 紧急联系人 当发生安全事件时: 1. **立即响应:** 遵循 [事件响应指南](docs/guides/06-incident-response.md) 2. **证据收集:** 运行 `./scripts/forensics/collect_evidence.sh` 3. **时间线重建:** 运行 `./scripts/forensics/build_timeline.sh --incident-dir ~/openclaw-incident-*` 4. **凭据范围界定:** 运行 `./scripts/forensics/check_credential_scope.sh` 5. **篡改检测:** 运行 `python scripts/forensics/verify_hash_chain.py --input ~/.openclaw/logs/telemetry.jsonl` 6. **遏制:** 执行特定事件类型的剧本 7. **沟通:** 使用事件响应指南中的模板 ### 响应剧本 | 事件类型 | 剧本 | 响应时间 | |---------------|----------|---------------| | **凭据外泄** | [剧本 1](docs/guides/06-incident-response.md#playbook-1-credential-exfiltration) | 5 分钟遏制 | | **提示注入** | [剧本 2](docs/guides/06-incident-response.md#playbook-2-prompt-injection-attack) | 10 分钟遏制 | | **未经授权访问** | [剧本 3](docs/guides/06-incident-response.md#playbook-3-unauthorized-network-access) | 2 分钟阻断 | | **恶意技能** | [剧本 4](docs/guides/06-incident-response.md#playbook-4-malicious-skill-installation) | 5 分钟隔离 | ## 🤖 CI/CD 与自动化 ### GitHub Actions 工作流 该框架包含自动化的安全扫描和合规检查: #### 安全扫描工作流(`.github/workflows/security-scan.yml`) 在每次 Pull Request 和每日计划任务运行: - **Trivy:** 容器和文件系统漏洞扫描(CRITICAL/HIGH 严重性) - **Bandit:** 针对脚本和示例的 Python 安全 Linter - **npm audit:** JavaScript 依赖漏洞扫描 - **pip-audit:** Python 依赖漏洞扫描 - **Gitleaks:** 秘密检测(API 密钥、密码、令牌) - **SBOM 生成:** CycloneDX 软件物料清单 **结果:** SARIF 文件上传至 GitHub Security 标签页,JSON 制品保留 90 天 #### 合规检查工作流(`.github/workflows/compliance-check.yml`) 验证配置和策略: - **策略验证:** 检查 SEC-002/003/004/005 合规性 - **YAML Linting:** 验证配置语法 - **安全测试:** 运行 pytest 安全测试套件 - **合规报告:** 生成 SOC 2/ISO 27001 报告 - **PR 评论:** 在 Pull Request 中自动显示合规百分比 **强制执行:** 如果合规性降至 95% 以下,则构建失败 ## 🤝 贡献 我们欢迎贡献!这是一份随着社区投入而不断改进的活文档。 ### 如何贡献 1. **在您的平台上测试:** 在您的环境中尝试这些程序 2. **记录问题:** 针对问题或缺口提出 GitHub Issue 3. **分享经验:** 提交包含改进内容的 PR 4. **添加示例:** 贡献新的配置示例或脚本 ### 贡献领域 - ✅ **高优先级:** - Windows 特定程序(目前部分覆盖) - AWS ECS / Azure Container Instances 配置 - CrowdStrike、Cortex XDR 和 SentinelOne 检测查询(已覆盖 MDE 和 Splunk) - Datadog / Elastic SIEM 集成示例 - 合规映射细节(SOC2、ISO 27001) - ⏳ **中优先级:** - 其他 VPN 提供商示例 - 云原生秘密管理(AWS Secrets Manager、Vault) - 多区域部署模式 - 灾难恢复程序 - 💡 **增强想法:** - 自动化安全测试套件 - Terraform/Pulumi 基础设施即代码示例 - 每个指南的视频教程 - 翻译文档(希伯来语、西班牙语等) ### 行为准则 保持尊重、建设性,并专注于为每个人改进 AI 代理安全。 ## 📖 仓库结构 ``` openclaw-security-playbook/ │ ├── README.md # Project overview and quick start │ ├── docs/ # Core documentation │ ├── architecture/ # System architecture and design │ ├── checklists/ # Operational checklists │ ├── compliance/ # Compliance frameworks │ ├── guides/ # Implementation guides │ ├── plan/ # Audit and execution plans │ ├── policies/ # Security policies and standards │ ├── procedures/ # Operational procedures │ ├── threat-model/ # Threat mapping and taxonomy │ └── troubleshooting/ # Troubleshooting guides │ ├── detections/ # Detection rules and hunting queries │ ├── README.md # Detection content overview │ ├── edr/ # EDR platform queries │ │ └── mde/ # Microsoft Defender for Endpoint (KQL) │ ├── ioc/ # Indicators of compromise (YARA, IOC) │ ├── siem/ # SIEM platform queries │ │ └── splunk/ # Splunk SPL queries │ └── sigma/ # Platform-agnostic Sigma rules │ ├── examples/ # Real-world examples and scenarios │ ├── incident-response/ # IR playbooks and templates │ ├── monitoring/ # Dashboards and alert rules │ ├── scenarios/ # Complete incident scenarios │ └── security-controls/ # Control implementations (Python) │ ├── scripts/ # Automation and tooling │ ├── credential-migration/ # Credential migration scripts │ ├── discovery/ # Discovery and scanning scripts │ ├── forensics/ # Forensics and evidence scripts │ ├── hardening/ # System hardening scripts │ ├── incident-response/ # IR automation scripts │ ├── monitoring/ # Monitoring automation scripts │ ├── supply-chain/ # Supply chain validation scripts │ ├── verification/ # Security verification scripts │ └── vulnerability-scanning/ # Vulnerability scanning scripts │ ├── configs/ # Configuration and policy files │ ├── agent-config/ # Agent configuration files │ ├── examples/ # Example deployment configs │ ├── mcp-server-config/ # MCP server configuration │ ├── monitoring-config/ # Monitoring configuration │ ├── organization-policies/ # Org-level policy JSON │ ├── skill-policies/ # Skill allowlist, enforcement, schemas │ └── templates/ # Secure config and gateway templates │ ├── tests/ # Test suite │ ├── integration/ # Integration tests │ ├── security/ # Security and adversarial tests │ └── unit/ # Unit tests │ ├── tools/ # Operational tools (Python CLI, validators) │ ├── certificate-manager.py │ ├── compliance-reporter.py │ ├── config-migrator.py │ ├── incident-simulator.py │ ├── openclaw-cli.py │ └── policy-validator.py │ ├── training/ # Security and developer training │ ├── developer-guide.md │ └── security-training.md │ ├── .github/ # GitHub automation │ ├── copilot-instructions.md # Copilot/agent instructions │ └── workflows/ # CI/CD workflows (security-scan, compliance-check, etc) │ ├── LICENSE # Repository license ├── CONTRIBUTING.md # Contribution guidelines ├── SECURITY.md # Security policy and disclosure └── CHANGELOG.md # Version history and updates ``` ## 🔗 更多资源 ### 培训材料 - **[安全团队培训](training/security-training.md)** - 4 小时安全运营培训 - 7 层防御架构 - 日常安全运营(漏洞扫描、合规检查) - 事件响应程序(IRP-001 执行) - 监控和告警(Grafana 仪表盘、Alertmanager 路由) - 动手实验(漏洞扫描、事件模拟、合规报告) - **[开发者集成指南](training/developer-guide.md)** - 2 小时开发者入职 - 快速开始和安装 - 安全控制集成(输入验证、速率限制、身份验证、加密) - 测试框架(单元/集成/安全测试) - CI/CD 集成(GitHub Actions 工作流) - 常见问题故障排除 ### 官方文档 - **OpenClaw 文档:** https://docs.openclaw.ai - **Anthropic 安全最佳实践:** https://www.anthropic.com/safety - **Claude 安全指南:** https://docs.anthropic.com/claude/docs/security ### 安全框架 - **OWASP LLM Top 10:** https://owasp.org/www-project-top-10-for-large-language-model-applications/ - **NIST AI 风险管理:** https://www.nist.gov/itl/ai-risk-management-framework - **CIS Docker Benchmark:** https://www.cisecurity.org/benchmark/docker ### 研究与出版物 - **AI 代理安全研究:** https://arxiv.org/abs/2302.12173 - **提示注入分类法:** https://arxiv.org/abs/2402.00898 - **AI 供应链安全:** https://dl.acm.org/doi/10.1145/3634737.3656289 ## 📜 许可证 本项目根据 MIT 许可证授权 - 详见 [LICENSE](LICENSE) 文件。 ``` MIT License Copyright (c) 2026 [Your Organization] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. ``` ## 🙏 致谢 本剧本基于以下内容开发: - **真实事件研究**,来自 2024-2025 年暴露的 AI 代理发现 - **社区贡献**,来自安全研究人员和从业者 - **最佳实践**,来自 OWASP、NIST、CIS 和其他安全框架 - **开源工具**,来自 AI 安全社区(Knostic、Anthropic 等) 特别感谢: - Anthropic 提供的 Claude 和 AI 安全研究 - OWASP LLM 安全社区 - 所有分享其事件经验教训的贡献者 ## 📞 支持 ### 获取帮助 - **文档问题:** 提出 GitHub Issue - **一般讨论:** GitHub Discussions - **紧急安全问题:** 遵循 [SECURITY.md](SECURITY.md) 中的负责任披露流程 ### 快速链接 - 🚀 **[快速开始(15 分钟) →](docs/guides/01-quick-start.md)** - 📖 **[所有指南 →](docs/guides/)** - ⚙️ **[配置示例 →](configs/examples/)** 🚨 **[事件响应 →](docs/guides/06-incident-response.md)** - 🛠️ **[脚本与工具 →](scripts/)** ## ⭐ 为本仓库加星 如果本剧本帮助您保护了 AI 代理,请为仓库加星以帮助其他人发现它!
**[开始使用 →](docs/guides/01-quick-start.md)** | **[报告问题](https://github.com/YOUR-ORG/clawdbot-security-playbook/issues)** | **[贡献](CONTRIBUTING.md)** 为 AI 代理安全而用 🔒 制作 **版本 3.0.0** | **最后更新:** 2026 年 2 月 | **110+ 文件** | **100% SOC 2/ISO 27001 合规**
标签:AI安全, AI治理, ATT&CK覆盖, Chat Copilot, CIDR输入, Clawguard, Cutter, DNS 反向解析, GDPR, GPT, ISO 27001, JSONLines, OpenClaw, SOC 2, SSH隧道, 人工智能安全, 凭证暴露, 反向代理, 合规性, 备份文件持久化, 安全剧本, 安全助手, 安全运营, 恶意插件, 扫描框架, 数据分类, 文档安全, 智能体安全, 漏洞管理, 生产就绪, 端点防护, 纵深防御, 网络安全, 自定义请求头, 请求拦截, 身份验证绕过, 逆向工具, 配置安全, 防御纵深, 隐私保护, 零信任