sunehrisahel/prompt-injection-red-team
GitHub: sunehrisahel/prompt-injection-red-team
用于对 prompt injection 检测器进行对抗性评估的 Streamlit 控制台,帮助安全团队测试和提升 LLM 输入安全检测能力。
Stars: 0 | Forks: 0
# Prompt Injection Red Team
用于测试 prompt-injection 检测器的对抗性评估控制台。这是一个包含 Assistant、Attack Lab、Arena 对战和修复指南的 Streamlit 工作区。
通过 HTTP 调用检测器 API —— **此应用中不需要 Anthropic API key**。LLM 功能使用检测器服务上的 `POST /red-team/*` 接口。
## 快速开始(本地)
**终端 1 — 检测器 API**(来自 [prompt-injection-detector](https://github.com/sunehrisahel/prompt-injection-detector)):
```
uvicorn app.main:app --port 8000
```
**终端 2 — red team 控制台:**
```
pip install -r requirements.txt
cp .env.example .env
# DETECTOR_URL=http://localhost:8000/analyze
# RED_TEAM_API_KEY 如果已设置,必须与 detector 匹配
streamlit run dashboard.py
```
打开 http://localhost:8501
## 在 Render 上部署
1. 首先部署 [prompt-injection-detector](https://github.com/sunehrisahel/prompt-injection-detector)
2. [在 Render 上连接此代码库](https://render.com/deploy)
3. 设置环境变量:
- `DETECTOR_URL` = `https://YOUR-DETECTOR.onrender.com/analyze`
- `RED_TEAM_API_KEY` = 与检测器上的值相同
- `RED_TEAM_PASSWORD` = 控制面板登录密码
4. 打开此服务的 Render URL
## 零停机迁移
在测试新 URL 时,请保持旧的 monorepo Render 服务继续运行。验证通过后再切换流量,然后删除旧服务。
## 相关代码库
- [prompt-injection-detector](https://github.com/sunehrisahel/prompt-injection-detector) — 检测器 API + 可选的 SecureChat UI
## License
MIT
标签:AI安全, Chat Copilot, Kubernetes, Prompt注入, Python脚本, Streamlit, 大模型, 对抗性测试, 红队评估, 访问控制, 逆向工具