jrubiosainz/copilot-rampart-suite

GitHub: jrubiosainz/copilot-rampart-suite

该工具是一个基于 pytest 的安全测试套件,用于在 CI 中自动检测 GitHub Copilot 自定义 agent 对抗提示注入、数据泄露等攻击向量的防护能力。

Stars: 0 | Forks: 0

# copilot-rampart-suite 一个开箱即用的 RAMPART 测试套件,专为 GitHub Copilot 自定义 agent 设计。为你的 `.agent.md` agent 编写 prompt injection 和安全测试,并在 CI 中通过单个 `pytest` 命令运行它们。 ## 功能 1. 定义了一个轻量级适配器,通过 Copilot Extensions API(或本地 mock)将 RAMPART 连接到任何 Copilot agent。 2. 内置 5 个预配置的测试场景,涵盖最常见的攻击向量: - 通过代码注释进行的跨 prompt 注入 - 通过 issue/PR 正文进行的间接注入 - Tool-call 劫持(MCP 沙箱逃逸) - 通过 markdown 链接进行的数据泄露 - 通过 system prompt 泄露进行的指令覆盖 3. 输出标准的 pytest 结果。接入 GitHub Actions,并在失败时阻止合并。 ## 快速开始 ``` pip install -r requirements.txt # 针对内置的 mock agent 运行 pytest tests/ -v # 针对真实的 Copilot agent endpoint 运行 export COPILOT_AGENT_URL=https://your-agent.example.com export COPILOT_AGENT_TOKEN=ghp_xxx pytest tests/ -v --live ``` ## 项目结构 ``` copilot-rampart-suite/ ├── README.md ├── requirements.txt ├── conftest.py # pytest fixtures + RAMPART adapter ├── adapter/ │ └── copilot_adapter.py # Thin adapter for Copilot Extensions API ├── agents/ │ └── sample.agent.md # Sample agent definition for testing ├── tests/ │ ├── test_cross_prompt_injection.py │ ├── test_indirect_injection.py │ ├── test_tool_hijack.py │ ├── test_exfiltration.py │ └── test_instruction_override.py └── .github/ └── workflows/ └── rampart.yml # CI workflow ``` ## 如何适配你的 agent 1. 将 `agents/sample.agent.md` 替换为你自己的 agent 定义。 2. 将 `COPILOT_AGENT_URL` 设置为你的 agent endpoint。 3. 按照现有的模式,在 `tests/` 中添加特定领域的场景。 ## 环境要求 - Python 3.11+ - RAMPART (`pip install rampart-ai`) - 一个 Copilot agent endpoint 或包含的 mock ## 许可证 MIT
标签:AI安全, Chat Copilot, LLM红队, LNA, Python, 大模型安全, 安全规则引擎, 无后门, 逆向工具