naninu123/ai-agent-security

GitHub: naninu123/ai-agent-security

该平台为自主 AI agent 提供实时安全监控与防护能力,涵盖 prompt 注入检测、操作审计追踪及可配置的防护栏规则。

Stars: 1 | Forks: 0

# 🛡️ AI Agent 安全仪表盘 [![Next.js](https://img.shields.io/badge/Next.js-15-black?style=flat-square&logo=next.js)](https://nextjs.org) [![React](https://img.shields.io/badge/React-19-61DAFB?style=flat-square&logo=react)](https://react.dev) [![TypeScript](https://img.shields.io/badge/TypeScript-5-3178C6?style=flat-square&logo=typescript)](https://www.typescriptlang.org) [![Security: Audited](https://img.shields.io/badge/Security-Audited-green.svg?style=flat-square)](https://github.com/naninu123/ai-agent-security) 一个专为自主 AI agent 打造的综合安全监控与防护平台 —— 旨在提供 prompt 注入防护、工具隔离以及沙箱强化。由 **SaboLabs Security** 运营。 ## 📋 概述 AI Agent 安全仪表盘是一个实时监控与安全执行平台,旨在保护 AI agent 部署免受常见攻击向量的威胁,包括 prompt 注入、越狱、数据泄露以及未经授权的工具使用。 随着 AI agent 变得愈发自主并深度融入关键工作流中,安全监控变得不可或缺。本仪表盘提供: - **实时威胁检测** —— 实时监控 agent 活动 - **Prompt 注入扫描** —— 在恶意输入到达 agent 之前检测并拦截 - **审计追踪** —— 所有 agent 操作的不可变日志及风险评分 - **可配置的防护栏** —— 无需重新部署即可切换安全规则 ## ✨ 功能 ### 🔍 安全仪表盘 - 实时威胁评分指示器(0–100 分制) - 带有严重程度级别(Critical / High / Medium / Low)的活跃警报信息流 - Agent 活动时间轴 - 系统健康指标(请求/分钟、已拦截威胁、正常运行时间) ### 💉 Prompt 注入扫描器 - 针对已知注入模式进行实时输入分析 - 检测:越狱、角色扮演攻击、指令覆盖、数据泄露尝试 - 风险级别分类:Safe / Low / Medium / High / Critical - 模式匹配高亮显示并附带解释 ### 📋 审计追踪 - 所有 agent 操作的带时间戳日志 - 操作类型标签:`tool_call`、`llm_query`、`file_access`、`network_request`、`auth_attempt` - 单次操作风险评分(0–100) - 支持按日期、操作类型和风险级别进行筛选 - 导出为 CSV/JSON 格式 ### ⚙️ 防护栏配置 - 单独开启/关闭各项安全规则 - 分类:输入验证、输出过滤、工具限制、速率限制 - 针对单条规则的敏感度调整 - 规则影响的实时预览 ## 🚀 快速开始 ### 前置条件 - Node.js 18+ - npm 或 yarn ### 安装说明 ``` # 克隆 repository git clone https://github.com/naninu123/ai-agent-security.git cd ai-agent-security # 安装 dependencies npm install # 运行 development server npm run dev ``` 在浏览器中打开 [http://localhost:3000](http://localhost:3000)。 ### 生产环境构建 ``` npm run build npm start ``` ## 🏗️ 项目结构 ``` ai-agent-security/ ├── app/ │ ├── layout.tsx # Root layout with dark theme │ ├── page.tsx # Dashboard home │ ├── scanner/ │ │ └── page.tsx # Prompt injection scanner │ ├── audit/ │ │ └── page.tsx # Audit trail log │ └── guardrails/ │ └── page.tsx # Guardrails configuration ├── components/ │ ├── ui/ │ │ ├── card.tsx # Card component │ │ ├── badge.tsx # Badge/tag component │ │ └── button.tsx # Button component │ ├── Navbar.tsx # Navigation sidebar │ ├── ThreatScore.tsx # Threat score gauge │ ├── AlertFeed.tsx # Live alert feed │ └── ActivityChart.tsx # Activity timeline chart ├── lib/ │ └── utils.ts # Utility functions └── public/ └── ... ``` ## 🔒 已检测到的安全模式 | 模式 | 描述 | 严重程度 | |---------|-------------|----------| | Prompt Injection | 通过用户输入覆盖系统指令 | Critical | | Jailbreak Attempt | 角色扮演或假设性语境以绕过规则 | High | | Data Exfiltration | 试图通过输出提取敏感数据 | High | | Instruction Override | 忽略先前指令的直接命令 | Critical | | Tool Abuse | 未经授权或过度调用工具 | Medium | | PII Leakage | 个人数据出现在 agent 输出中 | High | | SSRF via Agent | Agent 发起未经授权的网络请求 | High | | Privilege Escalation | 试图获取提升的权限 | Critical | | Denial of Service | 用消耗资源的密集请求淹没 agent | Medium | | Supply Chain Attack | 通过外部数据源注入恶意内容 | High | ## 🛠️ 技术栈 - **框架:** Next.js 15 (App Router) - **UI 库:** React 19 - **语言:** TypeScript 5 - **样式:** Tailwind CSS v4 - **图标:** Lucide React - **主题:** 暗色 —— 紫色 (#7C3AED) + 青色 (#06B6D4) ## 🗺️ 路线图 - [ ] WebSocket 实时更新 - [ ] 集成 OpenAI / Anthropic API 日志 - [ ] Webhook 警报 (Telegram, Slack, Discord) - [ ] 基于 ML 的异常检测 - [ ] 多 Agent 监控支持 - [ ] 基于角色的访问控制 (RBAC) - [ ] Docker 部署支持 - [ ] 用于外部日志接入的 API endpoint ## 📄 许可证 MIT License —— 详情请参阅 [LICENSE](LICENSE)。 ## 👤 作者 **sabo** —— [@setsutzy](https://twitter.com/setsutzy) & [@naninu123](https://github.com/naninu123) 由 SaboLabs 怀着 ❤️ 为 AI 安全社区构建。
标签:AI安全, Chat Copilot, React, Syscalls, TypeScript, 安全插件, 提示词注入防护, 自动化攻击