yashchauhan66/Soter-AI

GitHub: yashchauhan66/Soter-AI

SoterAI 是一个开源 AI 安全指挥层,通过实时护栏和开发者友好 API 保护聊天机器人、AI Agent 及 LLM 应用免受 prompt 注入、越狱、数据泄露等威胁。

Stars: 1 | Forks: 0

SoterAI Logo # SoterAI — 开源 AI 安全指挥层 **保护您的聊天机器人、RAG 应用和 AI agents 免受 prompt 注入、越狱、数据泄露和 agent 滥用 —— 提供深度防御护栏,并附带诚实、可复现的基准测试(在 1% 误报预算下达到 84% 的召回率,ROC-AUC 0.92)。**

GitHub Stars Launching June 30 on Product Hunt Live Demo Playground Documentation

84% recall at 1% false-positive rate ROC-AUC 0.92 93.8% precision 0.54% false-positive rate ~5ms p50 analyzer CPU latency CI/CD License OWASP LLM Top 10 mapped


**[✨ 功能](#-key-features) • [🏆 基准测试](#-benchmark-results) • [🚀 快速开始](#-quick-start) • [📋 服务](#-services-overview) • [🏗️ 架构](#️-architecture) • [🐳 部署](#-deployment)**
### 两款核心产品
Agent Control

For AI agents using email, CRM, databases, and payments

Action ledger with reversibility classification · Human-in-the-loop approval queue · Compensating action rollback with audit trail · Continuous compliance assurance
Usage Governance

For 50–500 employee companies using ChatGPT, Claude, Cursor

Company-wide AI usage policies · Department-specific rules · Provider allow/block lists · Employee DLP monitoring · Compliance reports for regulators
## 什么是 SoterAI? **SoterAI**(源自希腊语 *sōtēr* —— “拯救者、保护者”)是一个**开源的 AI 安全指挥层**,旨在保护聊天机器人、RAG 系统和自主 agents 免受以下威胁: - 🎯 **Prompt 注入与越狱攻击** - 🔓 **数据窃取与 PII 泄露** - 🤖 **恶意 agent 行为与工具滥用** - 🧠 **Memory 投毒与上下文篡改** - 💸 **LLM 成本失控与预算超支** - ⚖️ **违规与合规风险** - 🎛️ **不受控的 agent 操作**(支付、电子邮件、部署) - 🏛️ **影子 AI**(员工在缺乏治理的情况下私自使用) SoterAI 包含 **40 多项产品服务**,组织在 6 个防御层中 —— 监控、保护、检测、控制、合规和管理 —— 外加两款专用的**核心产品**(AI Agent 控制和 AI 使用治理),为 AI 系统提供了广泛的安全控制面。部分模块已明确标记为预览版,在生产环境集成方面尚存空白。
## ✨ 核心功能 ### 高级 LLM 攻击覆盖 近期的防护更新使 SoterAI 超越了经典的 prompt 注入和越狱检测。防护机制现在可以检测以下活动的迹象: - **编码与混淆攻击** - base64/base64url、十六进制、二进制、十进制字节、摩斯密码、leetspeak、紧凑空格、Unicode 控制字符、同形字标记以及凯撒位移 payload。 - **15 大高级越狱家族** - 角色扮演越狱、对抗性后缀、多语言木马、token 走私、ASCII 艺术走私、进化越狱生成、认知过载攻击、函数调用包装器、跨模态 payload、自动化链式攻击以及多 agent 妥协传播。 - **对抗性 NLP 攻击** - 不可察觉的扰动、梯度/词语替换规避、通用可迁移后缀、分类器/NER 规避、表格实体交换攻击以及跨语言对抗性适应。 - **后门与数据投毒企图** - 触发短语、语法/风格触发器、BadPrompt/BadPre/BITE 式投毒、投毒的 embeddings、LoRA/PEFT 安全妥协、代码搜索投毒、seq2seq 后门以及模型劫持 prompt。 - **llmsecurity.net 式攻击家族** - 训练数据提取、成员资格/私有属性推断、数据重建、LLM 资源耗尽、agent 远程代码执行/提权、包幻觉/依赖混淆、XSS/CSRF/CPRF 浏览器攻击、多模态视觉/音频 prompt 注入、模型窃取、攻击自动化以及检测器规避。 - **不安全的输出处理** - 模型生成的 HTML/脚本接收端、带凭证的浏览器请求、脚本外泄以及未经证实的软件包安装指引,将在到达下游系统前被拦截以供审查。 这些规则在 `tests/guard.test.ts` 中的回归测试以及 `lib/classifiers/datasets/guardRedTeamBenchmark.ts` 中的红队基准测试类别中得到了覆盖。 ### 🎛️ AI Agent 控制中心 (全新) | 能力 | 描述 | |------------|-------------| | **Agent 操作账本** | 使用基于点分操作名称的正则匹配模式,将每个 agent 操作分类为不可逆、补偿性操作或可逆 (`gmail.send`、`payment.charge`、`filesystem.write`) | | **可逆性引擎** | 自动推断回滚操作(例如,`ticket.close` -> `reopen_ticket`,`draft` -> `delete_draft`),并附带 SHA-256 证据哈希 | | **风险评分** | 基于回滚状态和操作关键字得出的 4 级风险分类(低/中/高/严重) | | **回滚窗口** | 针对补偿性/高风险操作的 15 分钟窗口,针对可逆操作的 60 分钟窗口 —— 均支持试运行 | | **人工审批队列** | 统一的 agent 防火墙拦截和交易托管队列,提供已脱敏的 payload 审查 | | **持续合规保障** | 实时合规态势评分,并附带 SOC 2 / ISO 27001 证据收集 | | **操作员审计追踪** | 人工回滚决策归因于操作员,并与 agent 生成的日志分开保留 | ### 🏛️ AI 使用治理 (全新) | 能力 | 描述 | |------------|-------------| | **5 步治理引擎** | 解析顺序:部门规则 -> 数据分类 -> 策略规则 -> 敏感数据覆盖 -> 策略默认值 | | **服务商允许/阻止列表** | 允许或阻止特定的 AI 服务商(OpenAI、Anthropic、DeepSeek),支持通配符和模型级别的模式 | | **部门规则** | 各部门专属的 AI 使用策略 —— 工程、市场、财务、法务等部门适用不同规则 | | **数据分类** | 定义哪些数据敏感度级别(公开、内部、受限、PII、财务、健康)可以被发送至哪些服务商 | | **审批工作流** | 为期 14 天自动过期的审批请求,附带批准/拒绝的审计日志条目 | | **员工监控** | 30 天统计、强制执行警报、被阻止服务商明细、使用时间线 | | **合规报告** | 周/月/季度报告,包含合规评分、发现的问题以及可操作的建议 | | **治理强制执行** | 集成于全部 3 条防护路径(输入/输出/流式传输)中 —— 返回 HTTP 403 状态码并附带 `X-Governance-Action` 和 `X-Governance-Reason` 标头 | | **通知分发** | 通过 Webhooks 和电子邮件向所有者/管理员用户发送拦截事件和审批请求通知 | ### 6 层 AI 安全架构

👁️ 监控

观察、分析并了解您的 AI 安全态势

  • 防护日志 — 每一项安全决策的完整审计追踪
  • 报告 — 包含趋势的自动化月度安全报告
  • 检测反馈 — 通过标记误报来提高准确性
  • 客户成功 — 激活率和流失风险分析

🛡️ 保护

保护您的 AI 免受攻击、滥用和数据泄露

  • Agent 防火墙 — 实时拦截未经授权的工具调用
  • 策略引擎 — 自定义风险阈值和操作默认值
  • RAG 安全 — 保护检索流水线免受恶意文档侵害
  • Webhooks — 实时签名的安全事件通知

🔍 检测

识别威胁、漏洞和可疑模式

  • 影子 AI — 发现未经授权的 AI 工具使用行为
  • 红队实验室 — 针对 100 多种对抗性场景进行测试
  • 取证 — 全面的安全事件调查工具包
  • 语义出口检测 — 检测改写形式的机密数据泄露
  • Canary 网络 — 使用触发式 token 来检测 prompt 注入

🎛️ 控制

通过细粒度策略管理 agent 行为

  • Agent 控制中心 — 统一的审批队列、可逆性账本和合规态势
  • Agent 护照 — 加密的 agent 身份验证
  • 操作账本 — 使用回滚窗口将操作分类为不可逆/补偿性/可逆
  • 交易托管 — 针对高风险操作引入人工干预机制
  • 意图防护 — 验证操作是否符合用户的原始意图
  • 工具链 — 检测高风险的多工具攻击序列
  • Memory 防火墙 — 隔离被投毒的 agent memory
  • MCP 漂移 — 检测 MCP 服务器工具变更
  • 法律边界 — 确保合规的硬性安全护栏

📋 合规

以审计就绪的证据满足合规要求

  • 证据保险库 — SOC 2 / ISO 27001 证据打包
  • 上下文血缘 — 追踪数据来源并阻止跨域泄露
  • 爆炸半径 — 评估 agent 被攻破后的潜在破坏范围
  • 凭证保险库 — 安全的服务器端凭证存储

⚙️ 管理

配置、监控和管理您的安全技术栈

  • 项目 — 多环境项目组织
  • API Keys — 具有独立速率限制的受限密钥
  • 成本防火墙 — 防止 LLM 开销失控
  • 安全徽章 — 实时防护状态标识
  • 审计导出 — 满足合规要求的审计日志导出

## 🏆 基准测试结果 该防护机制使用**完全版生产分类器** (`analyzeText`) 在一个**公开的 1,218 例语料库**上进行评估(108 个攻击样本 / 1,110 个无害样本,每个样本都标明了来源)。我们公布了对生产环境防护至关重要的指标 —— **在固定误报预算下的召回率** —— 而不是简单的“100%”得分。 | 指标 | 结果 | |--------|--------| | 🎯 **召回率 @ 1% FPR** | **84%**(在 1/100 的误报预算范围内捕获的攻击) | | 📈 **ROC-AUC** | **0.92**(与阈值无关的可分性) | | 🎯 **精确率** | **93.8%**(在 1,110 个无害输入上的误报率为 **0.54%**) | | 📊 **生产环境 F1 分数** | **0.89** | | 🧬 **多轮(渐进式)召回率** | 在 **0%** 的无害升级下达到 **60%**,平均约需 3.3 轮即可捕获 | | ⚡ **分析器延迟** | **~4.6ms p50 / ~7ms p95 / ~11ms p99**(纯 CPU 计算,无网络开销) | 使用 **`npm run benchmark:honest`** 重现所有结果。各类别的召回率(包括我们透明披露的薄弱环节)可在 [`/marks`](https://soterai.in/benchmarks) 页面查看。
## 🏗️ 架构 ``` ┌─────────────────────────────────────────────────────────┐ │ Your Application │ │ ┌────────────┐ ┌──────────┐ ┌──────────────────┐ │ │ │ Chatbot │ │ RAG App │ │ Autonomous Agent │ │ │ └─────┬──────┘ └────┬─────┘ └────────┬─────────┘ │ │ │ │ │ │ └────────┼──────────────┼──────────────────┼───────────────┘ │ │ │ ▼ ▼ ▼ ┌─────────────────────────────────────────────────────────┐ │ SoterAI Guard API │ │ │ │ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐ │ │ │ Input Guard │ │ Output Guard│ │Agent Firewall│ │ │ ├──────────────┤ ├─────────────┤ ├──────────────┤ │ │ │• Prompt Inj. │ │• PII Leak │ │• Tool Check │ │ │ │• Jailbreak │ │• Secrets │ │• Auth Verify │ │ │ │• Toxicity │ │• Toxicity │ │• Risk Score │ │ │ │• PII Redact │ │• Hallucin. │ │• Policy Eval │ │ │ └──────────────┘ └─────────────┘ └──────┬───────┘ │ │ │ │ │ ┌─────────────────────────────────────────┘ │ │ ▼ │ │ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐ │ │ │ Webhooks │ │ Reports │ │ Forensics │ │ │ │ & SIEM │ │ & Analytics │ │ & Audit │ │ │ └──────────────┘ └─────────────┘ └──────────────┘ │ │ │ └─────────────────────────┬─────────────────────────────────┘ │ ┌───────────────┼───────────────┐ ▼ ▼ ▼ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │ PostgreSQL │ │ Upstash │ │ Qdrant │ │ (Prisma) │ │ Redis │ │ (Vector DB) │ └─────────────┘ └──────────────┘ └──────────────┘ ``` ### 技术栈 | 组件 | 技术 | |-----------|-----------| | **框架** | Next.js 15.5 (TypeScript) + Turbopack | | **数据库** | PostgreSQL 16 + Prisma ORM 5.22 | | **缓存** | Upstash Redis | | **向量存储** | Qdrant(可选) | | **认证** | NextAuth v5 (JWT sessions) | | **支付** | Razorpay | | **UI** | Tailwind CSS + Lucide Icons | | **容器** | Docker(多阶段构建) | | **CI/CD** | GitHub Actions -> Docker Hub -> EC2 | | **SDKs** | TypeScript, Python, LangChain, LlamaIndex |
## 🚀 快速开始 ### 1️⃣ 单行安装 (Node.js) ``` npm install @soterai/core ``` ### 2️⃣ 基本用法 ``` import { Soter } from "@soterai/core"; const soter = new Soter({ apiKey: process.env.SOTERAI_API_KEY, }); // Guard user input before passing to LLM const result = await soter.guardInput({ message: userMessage, userId: "user_123", sessionId: "session_456", }); if (soter.shouldBlock(result)) { // 🛑 Blocked — don't call the LLM return { reply: "Message blocked for security reasons." }; } const safeInput = soter.getSafeText(result, userMessage) ?? userMessage; const llmResponse = await callMyLLM(safeInput); // Guard the output before returning to user const outputResult = await soter.guardOutput({ aiResponse: llmResponse, sessionId: "session_456", }); const safeOutput = soter.getSafeText(outputResult, llmResponse) ?? llmResponse; return { reply: safeOutput }; ``` ### 3️⃣ 自托管 ``` docker pull yashchauhan66/soter:latest docker run -p 3000:3000 --env-file .env.production yashchauhan66/soter:latest ```
📄 环境要求:.env.production(点击展开) ``` # 必需 DATABASE_URL=postgresql://user:pass@host:5432/soter AUTH_SECRET= # API Keys SOTERAI_API_KEY= # 可选 REDIS_URL=redis://... QDRANT_URL=http://qdrant:6333 SLM_API_KEY=sk-... ```

## 📋 服务概览 | 类别 | 服务 | 描述 | |----------|---------|-------------| | **🎛️ Agent 控制** | [Agent 控制中心](https://soterai.in/docs/services/agent-control) | 统一的审批队列、可逆性账本和合规态势 | | | [Agent 防火墙](https://soterai.in/docs/services/agent-firewall) | 实时 agent 操作监控与阻断 | | | [操作账本](https://soterai.in/docs/services/action-ledger) | 使用回滚机制将操作分类为不可逆/补偿性/可逆 | | | [身份基石](https://soterai.in/docs/services/identity-fabric) | 加密的 agent 身份、委派链和服务主体 | | | [Agent 护照](https://soterai.in/docs/services/agent-passports) | 加密的 agent 身份验证 | | | [交易托管](https://soterai.in/docs/services/transaction-escrow) | 针对高风险 agent 操作的人工干预机制 | | | [意图防护](https://soterai.in/docs/services/intent-guard) | 验证操作是否符合用户的原始意图 | | | [工具链](https://soterai.in/docs/services/tool-chain) | 多步骤攻击模式检测 | | | [试运行沙盒](https://soterai.in/docs/services/dry-run-sandbox) | 在不影响生产环境的情况下模拟策略 | | | [Memory 防火墙](https://soterai.in/docs/services/memory-firewall) | 隔离被投毒的 agent memory | | | [MCP 漂移](https://soterai.in/docs/services/mcp-drift) | 监控 MCP 服务器工具变更 | | | [法律边界](https://soterai.in/docs/services/legal-boundary) | 满足合规要求的硬性安全护栏 | | **🏛️ 使用治理** | [治理仪表板](https://soterai.in/docs/services/usage-governance) | 全公司范围的 AI 使用策略管理 | | | [策略配置](https://soterai.in/docs/services/governance-policy) | 默认操作、数据处理规则和审批要求 | | | [服务商规则](https://soterai.in/docs/services/governance-providers) | 允许/拦截特定的 AI 服务商和模型 | | | [部门规则](https://soterai.in/docs/services/governance-departments) | 各部门专属的 AI 使用策略 | | | [数据分类](https://soterai.in/docs/services/governance-data-classification) | 数据敏感度级别与对应服务商的映射 | | | [审批工作流](https://soterai.in/docs/services/governance-approvals) | 审查并管理 AI 服务商访问权限申请 | | | [员工监控](https://soterai.in/docs/services/governance-monitoring) | 追踪整个组织内的 AI 使用情况 | | | [审计追踪](https://soterai.in/docs/services/governance-audit) | AI 使用情况和策略变更的完整日志 | | | [合规报告](https://soterai.in/docs/services/governance-reports) | 周/月/季度治理报告 | | **👁️ 监控** | [防护日志](https://soterai.in/docs/services/guard-logs) | 每一次安全决策的完整审计追踪 | | | [报告](https://soterai.in/docs/services/reports) | 包含趋势分析的自动化安全报告 | | | [检测反馈](https://soterai.in/docs/services/detection-feedback) | 通过标记误报来提升检测准确率 | | | [客户成功](https://soterai.in/docs/services/customer-success) | 激活率和流失风险分析 | | **🛡️ 保护** | [Agent 防火墙](https://soterai.in/docs/services/agent-firewall) | 实时 agent 操作监控与阻断 | | | [策略引擎](https://soterai.in/docs/services/policy-engine) | 可配置的风险阈值和操作策略 | | | [RAG 安全](https://soterai.in/docs/services/rag-security) | 文档扫描与检索时防护 | | | [Webhooks](https://soterai.in/docs/services/webhooks) | 签名的实时安全事件通知 | | **🔍 检测** | [影子 AI](https://soterai.in/docs/services/shadow-ai) | 揭示未经授权的 AI 工具使用行为 | | | [红队实验室](https://soterai.in/docs/services/red-team-lab) | 100 多种对抗性攻击场景 | | | [取证](https://soterai.in/docs/services/forensics) | 事件调查与根本原因分析 | | | [语义出口检测](https://soterai.in/docs/services/semantic-egress) | 检测改写形式的机密数据泄露 | | | [Canary 网络](https://soterai.in/docs/services/canary-network) | 用于检测 prompt 注入的触发式 token | | **📋 合规** | [证据保险库](https://soterai.in/docs/services/evidence-vault) | SOC 2 / ISO 27001 证据打包 | | | [上下文血缘](https://soterai.in/docs/services/context-lineage) | 数据来源追踪与跨域泄露阻断 | | | [爆炸半径](https://soterai.in/docs/services/blast-radius) | Agent 遭受破坏时的损害评估 | | | [凭证保险库](https://soterai.in/docs/services/credential-vault) | 面向 agents 的安全凭证存储 | | **⚙️ 管理** | [项目](https://soterai.in/docs/services/projects) | 多环境项目组织管理 | | | [API Keys](https://soterai.in/docs/services/api-keys) | 具有独立速率限制的受限密钥 | | | [成本防火墙](https://soterai.in/docs/services/cost-firewall) | 防止 LLM 开销失控 | | | [安全徽章](https://soterai.in/docs/services/security-badges) | 实时防护状态标识 | | | [账单](https://soterai.in/docs/services/billing) | 计划管理与用量追踪 | | | [设置](https://soterai.in/docs/services/settings) | 个人资料、团队和偏好设置 | | | [审计导出](https://soterai.in/docs/services/audit-exports) | 满足合规要求的审计日志导出 | | | [新手引导](https://soterai.in/docs/services/onboarding) | 带有实时验证的引导式设置流程 |
## 🔌 SDKs 与集成 | 平台 | 包名 | 状态 | |----------|---------|--------| | **Node.js / TypeScript** | `@soterai/core` | ✅ 稳定 | | **Python** | `@soterai/python` | ✅ 稳定 | | **Next.js** | `@soterai/core/next` | ✅ 稳定 | | **Express** | `@soterai/core/express` | ✅ 稳定 | | **LangChain** | `@soterai/langchain-middleware` | ✅ 稳定 | | **LlamaIndex** | `@soterai/llamaindex-middleware` | ✅ 稳定 | | **WordPress** | 可用的插件包 | ✅ 稳定 | | **Botpress** | 集成渠道 | ✅ 稳定 | | **Intercom** | 集成渠道 | ✅ 稳定 | | **Zendesk** | 集成渠道 | ✅ 稳定 | | **WhatsApp** | Business API 集成 | ✅ 稳定 | | **REST API** | `/api/*` 路由(详见 [API 文档](/docs/rest-api)) | ✅ 已实现 |
## 🐳 部署 ### Docker (生产环境) ``` # Build docker build -t soter:latest --secret id=npmrc,src=$HOME/.npmrc . # 运行 docker run -p 3000:3000 --env-file .env.production soter:latest ``` ### CI/CD 流水线 (自动化) 该项目包含一个通过 GitHub Actions 实现的**全自动 CI/CD 流水线**: | 阶段 | 描述 | |-------|-------------| | 🔨 **构建与类型检查** | TypeScript 编译 + Prisma 验证 | | 🧪 **测试** | 50+ 测试套件(670+ 个通过的测试)覆盖所有安全服务 | | 🐳 **Docker 构建与推送** | 多阶段构建 -> Docker Hub | | 🚀 **部署到 EC2** | SSH -> 拉取镜像 -> 重启容器 | 只要推送到 `main` 分支,即会自动触发部署。 ### 架构 ``` GitHub Push → GitHub Actions → Docker Hub → EC2 Instance │ ┌─────────┴──────────┐ │ docker-compose │ │ or docker run │ │ with --env-file │ └─────────┬──────────┘ │ ┌─────────▼──────────┐ │ App (port 3000) │ │ Redis (cache) │ │ Qdrant (vectors) │ └────────────────────┘ ```
## 🧪 测试 ``` # 运行所有测试(50+ test suites,670+ tests) npm test # TypeScript typecheck npm run typecheck # SDK 测试 npm run test:sdk:js npm run test:sdk:python # Integration tests npm run test:integrations # E2E 测试(Playwright) npm run test:e2e # Production env 验证 npx tsx scripts/validate-env.ts # 完整验证 npm run verify ``` Playwright 会执行数据库迁移并加载种子固件。请通过 `E2E_DATABASE_URL` 使用专门的本地数据库;作为安全兜底措施,系统也接受 仅限回环地址的 `DATABASE_URL`。除非您显式地将其再次指定为 `E2E_DATABASE_URL` 以确认其仅供测试使用,否则系统绝不会修改 远程默认的 `DATABASE_URL`。 ### 已验证的测试结果(截至 2026-06-29) | 套件 | 测试数 | 结果 | |-------|------:|--------| | 认证(注册、验证、重置) | 11 | ✅ 全部通过 | | 防护(输入/输出、决策) | 34 | ✅ 全部通过 | | Agent 防火墙 (MVP1-3) | 25 | ✅ 全部通过 | | Agent 护照 / 意图 / 托管 | 50 | ✅ 全部通过 | | 工具链 / 试运行 / Canary | 25 | ✅ 全部通过 | | 语义出口 / 证据 / RAG | 20 | ✅ 全部通过 | | 高级安全 (MVPs 1-3) | 20 | ✅ 全部通过 | | 安全(XSS、速率限制、数据净化) | 13 | ✅ 全部通过 | | 攻击包回归测试 | 74 | ✅ 全部通过 | | 阶段测试 (Phase Tests 2-12) | 67 | ✅ 全部通过 | | SLM 评估 / 性能 | 15 | ✅ 全部通过 | | 账单 / Webhooks / 数据保留 | 20 | ✅ 全部通过 | | API 路由审计 / 集成 | 15 | ✅ 全部通过 | | 服务目录契约测试 | 2 | ✅ 全部通过 | | 深度 Agent 控制与治理 | 101 | ✅ 全部通过 | | 治理强制执行 | 35 | ✅ 全部通过 | | 身份基石 | 100 | ✅ 全部通过 | | Agent 控制指标 | 2 | ✅ 全部通过 | | **总计** | **~670+** | **✅ 全部通过** | 测试套件涵盖:认证、防护、agent 防火墙、agent 护照、身份基石、意图验证、工具链、托管、试运行、语义出口、证据保险库、Canary 网络、RAG、SLM 评估、账单、Webhooks、数据保留、API 契约验证、agent 控制(操作账本、可逆性、回滚)、使用治理(5 步引擎、强制执行、通知、审批工作流、合规报告)等。
## 🛠️ 开发设置 ``` # 1. Clone 并安装 git clone https://github.com/yashchauhan66/Ai-Security-Guard.git cd Ai-Security-Guard npm install # 2. 设置 PostgreSQL database createdb soter npx prisma migrate deploy # 3. 配置环境 cp .env.example .env.local # 使用你的设置编辑 .env.local # 4. 启动 dev server npm run dev # → http://localhost:3000 # 5. Seed database(可选) npm run db:seed ```
## 📊 合规与标准 SoterAI 旨在帮助您满足: | 框架 | 覆盖范围 | |-----------|----------| | **OWASP LLM Top 10** | ✅ 全部 10 个类别的完整映射 | | **SOC 2** | ✅ 针对安全性、可用性、机密性收集证据 | | **ISO 27001** | ✅ 针对 A.8(访问控制)、A.12(操作安全)收集证据 | | **HIPAA** | ✅ PII/PHI 检测与脱敏 | | **GDPR** | ✅ 数据主体请求工作流 | | **DPDP(印度)** | ✅ 同意记录、违规通知 | | **PCI-DSS** | ✅ 密钥检测与掩码 |
## 🧠 为什么选择 SoterAI?
对比 护栏与内容过滤器 传统的内容过滤器只能匹配已知模式。SoterAI 使用**语义理解**、**行为分析**和**多层防御**来捕获: - 从未见过的新型 prompt 注入攻击 - 改写形式的机密数据(语义出口检测) - 逐步推进的多轮操纵(意图防护) - 多步骤工具链攻击(工具链检测器) - 跨会话的 Memory 投毒(Memory 防火墙)
对比 Agent 监控平台 大多数 agent 监控工具是**以可观测性优先**的 —— 它们只向您展示发生了什么。而 SoterAI 是**以保护优先**的 —— 我们会在攻击造成破坏之前实时阻断它们,并提供完整的审计追踪以供事后分析。
对比 DIY 安全包装器 构建您自己的安全层意味着需要维护 30 多种检测模型、策略引擎、合规以及一个实时仪表板。SoterAI 为您开箱即用地提供所有这些功能,且基础保护无需任何配置。

## 📁 项目结构 ``` ├── app/ # Next.js app (pages, API routes) │ ├── api/ # REST API endpoints │ │ ├── guard/ # Input/output/streaming guard with governance enforcement │ │ └── agent/ # 23 agent API routes (firewall, ledger, passport, escrow) │ ├── dashboard/ # Dashboard (50+ feature pages) │ │ ├── agent-control/ # Agent Control Center (approval queue, ledger, compliance) │ │ ├── usage-governance/ # 9 governance sub-pages (policy, providers, departments, etc.) │ │ ├── agent-firewall/ # 8 agent firewall dashboard pages │ │ └── ... # 12 advanced security dashboards + more │ ├── docs/ # Documentation pages │ └── (public pages) # Marketing, pricing, etc. ├── components/ # React components │ ├── auth/ # Auth UI │ ├── dashboard/ # Dashboard widgets │ ├── docs/ # Doc components │ └── ui/ # Shared UI primitives ├── lib/ # Shared utilities & services │ ├── agent-firewall/ # Agent firewall logic │ ├── agent-action-ledger/ # Action classification & reversibility engine │ ├── agent-control/ # Control metrics & rollback window state │ ├── usage-governance/ # Governance engine, notifications, 5-step resolution │ ├── guard/ # Guard analysis engine │ ├── auth/ # Auth helpers │ └── docs/ # Service documentation data ├── packages/ # SDK packages (monorepo) │ ├── sdk/ # TypeScript SDK │ └── python-sdk/ # Python SDK ├── prisma/ # Database schema & migrations (14+ agent/governance models) ├── workers/ # Background workers ├── scripts/ # Maintenance & CI scripts ├── tests/ # Test suites (50+, 670+ tests) ├── examples/ # Example integrations ├── .github/workflows/ # CI/CD pipeline └── docker-compose.prod.yml # Production Docker setup ```
## 🤝 参与贡献 我们欢迎您的贡献! 1. Fork 本仓库 2. 创建功能分支 (`git checkout -b feature/amazing-feature`) 3. 提交更改 (`git commit -m "Add amazing feature"`) 4. 推送到分支 (`git push origin feature/amazing-feature`) 5. 发起 Pull Request
## 📄 许可证 SoterAI 是 **open core**(开放核心)的,而非 MIT 许可证。不同部分的授权方式不同 —— 详见 [LICENSING.md](LICENSING.md) 了解完整说明: - **核心产品与服务器** — [商业源码许可证 1.1](LICENSE)(源码可用;生产/SaaS/竞争性使用需向 Yash Chauhan 获取商业许可;将于 2030-06-25 自动转换为 Apache-2.0)。 - **客户端 SDKs 与中间件** (`packages/*`) — Apache-2.0,可免费集成。 - **企业模块** — 商业授权,保留所有权利。 版权所有 © 2026 Yash Chauhan。参与贡献需要签署 [CLA](CLA.md)。

Star us

⭐ Star us on GitHub — it helps developers discover SoterAI and makes AI safer for everyone!


🌐 Website📖 Docs🎮 Playground💵 Pricing🐛 Issues💬 Discussions

Built with ❤️ for the AI security community | Open core (BSL 1.1) | India-first PII detection

标签:API, DLL 劫持, Naabu, 人工智能安全, 内容安全, 合规性, 大语言模型, 护栏, 防御机制