scmdr/incident-response-tool

GitHub: scmdr/incident-response-tool

基于 Claude AI 的智能事件响应平台,整合多源告警并提供自动化分诊与分步修复指南。

Stars: 0 | Forks: 0

# 事件响应工具 一个 AI 驱动的事件响应平台,可连接任何数据源 —— GitHub、AWS CloudWatch、PagerDuty 或任何 HTTP API —— 并使用 Claude AI 进行识别、分诊,并指导您的团队完成修复。 ## 功能特性 - **多源摄取** — GitHub(CI/CD 失败、密钥扫描)、AWS CloudWatch 警报、PagerDuty 警报、通用 HTTP 端点 - **AI 驱动的分诊** — Claude Opus 分析事件并生成根因分析、影响评估和严重性评级 - **分步修复** — 有序且可操作的步骤,附带可选的 CLI 命令和文档链接 - **事件生命周期** — 检测中 → 分诊中 → 缓解中 → 已解决 → 复盘 - **AI 聊天** — 向 Claude 询问关于当前活跃事件的任何问题 - **时间线** — 事件、系统操作和用户备注的完整审计跟踪 - **Web 仪表板** — 为安全专家和非技术利益相关者提供简洁的 UI ## 快速开始 ``` # 安装依赖 npm install # 配置环境 cp .env.example .env # 使用你的 API keys 编辑 .env # 在 development 中运行 npm run dev # → 打开 http://localhost:3000 ``` ## 配置 将 `.env.example` 复制到 `.env` 并填写您要使用的密钥: | Variable | Required | Description | |---|---|---| | `ANTHROPIC_API_KEY` | Yes | Claude API key for AI analysis | | `GITHUB_TOKEN` | Optional | GitHub personal access token | | `GITHUB_ORG` | Optional | GitHub org to scan | | `PAGERDUTY_API_KEY` | Optional | PagerDuty API key | | `PAGERDUTY_SERVICE_ID` | Optional | Specific service to watch | | `AWS_ACCESS_KEY_ID` | Optional | AWS credentials | | `AWS_SECRET_ACCESS_KEY` | Optional | AWS credentials | | `AWS_REGION` | Optional | AWS region (default: us-east-1) | | `WEBHOOK_SOURCES` | Optional | Comma-separated HTTP endpoints to poll | ## API 参考 ``` GET /api/incidents List all incidents POST /api/incidents Create incident GET /api/incidents/:id Get incident detail PATCH /api/incidents/:id/status Update status POST /api/incidents/:id/analyze Trigger Claude AI analysis POST /api/incidents/:id/chat Chat with Claude about the incident POST /api/incidents/:id/events Ingest an event POST /api/incidents/:id/timeline Add timeline note POST /api/incidents/:id/remediation/:order/complete Mark step done DELETE /api/incidents/:id Delete incident GET /api/sources List configured sources POST /api/sources/scan Scan all sources for events POST /api/sources/:type/test Test a source connection POST /api/sources/:type/fetch Fetch events from a source GET /api/health Health check ``` ## 架构 ``` incident-response-tool/ ├── src/ │ ├── index.ts # Express server │ ├── types/index.ts # Shared TypeScript types │ ├── engine/ │ │ └── incident.ts # Incident state machine (in-memory store) │ ├── connectors/ │ │ ├── github.ts # GitHub connector │ │ ├── pagerduty.ts # PagerDuty connector │ │ ├── aws.ts # AWS CloudWatch connector │ │ └── http.ts # Generic HTTP connector │ ├── ai/ │ │ └── claude.ts # Claude Opus AI integration │ └── api/ │ ├── incidents.ts # Incident API routes │ └── sources.ts # Data source API routes └── public/ ├── index.html # Dashboard UI ├── styles.css # Dark-theme styles └── app.js # Frontend JavaScript ``` ## 扩展 ### 添加自定义数据源 从 `src/types/index.ts` 实现 `IConnector`: ``` import { IConnector, ConnectorFetchResult } from '../types/index.js'; export class MyConnector implements IConnector { type = 'http' as const; name = 'My System'; isConfigured() { return Boolean(process.env.MY_API_KEY); } async testConnection() { return { ok: true, message: 'Connected' }; } async fetchEvents(since?: Date): Promise { // ... fetch and return IncidentEvent[] } } ``` 然后在 `src/api/sources.ts` 中注册它。 ## 生产环境注意事项 - 将 `src/engine/incident.ts` 中的内存存储替换为数据库(PostgreSQL、MongoDB 等) - 在对外开放前添加身份验证(API keys、OAuth) - AWS 连接器使用模拟数据 —— 集成 `@aws-sdk/client-cloudwatch` 以获取真实警报
标签:Anthropic, API集成, AWS CloudWatch, CI/CD监控, CIS基准, Claude AI, FTP漏洞扫描, GitHub集成, GNU通用公共许可证, IT运维, LLM, MITM代理, Node.js, PagerDuty, SaaS平台, Socks5代理, SRE, TypeScript, Unmanaged PE, Web仪表盘, 事件管理, 事后分析, 人工智能, 偏差过滤, 可观测性, 告警分流, 安全事故响应, 安全插件, 安全编排, 审计追踪, 故障修复, 根因分析, 用户模式Hook绕过, 自动化攻击, 自动化运维