GitHubSecurityLab/seclab-taskflows
GitHub: GitHubSecurityLab/seclab-taskflows
GitHub Security Lab 的示例任务流仓库,配合 Taskflow Agent 使用 AI Agent 进行代码漏洞审计、GHSA 变体分析和安全问题分类。
Stars: 5 | Forks: 4
# GitHub Security Lab Taskflows
本仓库包含用于 [SecLab Taskflow Agent](https://github.com/GitHubSecurityLab/seclab-taskflow-agent) 的示例 taskflow,以及运行这些 taskflow 所需的自定义 MCP server。
## 快速开始
* 前往 https://github.com/GitHubSecurityLab/seclab-taskflows 并启动一个 codespace。
* 等待几分钟以启动 codespace。当你在终端的提示符前看到 `(.venv)` 时,就表示准备好了。
* 运行演示:
```
python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.ghsa_variant_analysis_demo -g repo=github/cmark-gfm -g ghsa=GHSA-c944-cv5f-hpvr
```
现在尝试在你自己的某个项目上运行我们的审计 taskflow。
在这里,我们以 [OWASP Juice Shop](https://github.com/juice-shop/juice-shop) 为例:
```
./scripts/audit/run_audit.sh juice-shop/juice-shop
```
审计结果会被写入一个 SQLite 数据库,运行结束时会在 SQLite 查看器中自动打开该数据库。结果存储在名为 “audit_result” 的表中。该表有一个名为 “has_vulnerability” 的列,在最可能是真实漏洞的行中会有复选标记。
## 使用 docker 脚本运行
我们建议在沙箱环境中运行 taskflow。[GitHub Codespaces](https://github.com/features/codespaces) 很方便,或者如果你愿意,可以使用脚本 [`run_seclab_agent.sh`](scripts/run_seclab_agent.sh) 来运行 `seclab-taskflow-agent` 的 docker 容器,具体说明见[此处](https://github.com/GitHubSecurityLab/seclab-taskflow-agent/tree/main?tab=readme-ov-file#deploying-from-docker)。请注意,此脚本需要从 repo 的主目录运行,并且包含自定义 MCP server 数据存储环境变量的 `.env` 文件需要位于同一目录中。
首先,在 repo 的主目录中创建一个 `.env` 文件。对于 [`run_seclab_agent.sh`](scripts/run_seclab_agent.sh),你可以使用:
```
MEMCACHE_STATE_DIR=/app/data
CODEQL_DBS_BASE_PATH=/app/data
DATA_DIR=/app/data
LOG_DIR=/app/logs
```
需要 `MEMCACHE_STATE_DIR` 来持久化 memcache 中的一些中间数据,需要 `DATA_DIR` 供各种 mcp server 存储中间结果,而 `LOG_DIR` 用于存储 server 生成的日志文件。这些可以在主目录的 `.env` 文件中设置。如果没有为自定义 MCP server 设置环境变量,相关文件夹将被自动创建。位置取决于平台,并由 [`platformdirs`](https://pypi.org/project/platformdirs/) 设置。
此外,还需要通过[环境变量或 Codespace secrets](https://github.com/GitHubSecurityLab/seclab-taskflow-agent?tab=readme-ov-file#configuration) 配置 AI API endpoint 和 secret。特别是,需要将环境变量 `AI_API_TOKEN` 和 `AI_API_ENDPOINT` 设置为适当的 AI API endpoint 和凭证。如果未设置,默认的 `AI_API_ENDPOINT` 是 GitHub models:
```
AI_API_ENDPOINT="https://models.github.ai/inference"
```
此外,还需要设置 `GH_TOKEN` 环境变量,以允许与 GitHub API 进行交互,例如获取内容、创建 issue 等。
个别 taskflow 可能需要额外的设置,有关进一步的要求,请参阅相关子目录中的 `README.md`。
设置好相关的 env var 后,使用以下命令运行示例 taskflow:
```
./scripts/run_seclab_agent.sh -t seclab_taskflows.taskflows.audit.ghsa_variant_analysis_demo -g repo=github/cmark-gfm -g ghsa=GHSA-c944-cv5f-hpvr
```
## 背景
[SecLab Taskflows](https://github.com/GitHubSecurityLab/seclab-taskflows) 是 [SecLab Taskflow Agent](https://github.com/GitHubSecurityLab/seclab-taskflow-agent) 仓库的配套仓库。
SecLab Taskflow Agent 是由 [GitHub Security Lab](https://securitylab.github.com/) 维护的实验性 agentic framework。本仓库提供了与 SecLab Taskflow Agent 配合使用的示例 taskflow 和支持资源。我们正在使用该 agent 和这些 taskflow 来试验将 AI Agent 用于安全目的,例如审计代码漏洞或对 issue 进行分类。
我们很乐意听取你的反馈。请[创建一个 issue](https://github.com/GitHubSecurityLab/seclab-taskflows/issues/new/choose) 向我们发送功能请求或错误报告。我们也欢迎 pull request(如果你希望做出贡献,请参阅我们的[贡献指南](./CONTRIBUTING.md)以了解更多信息)。
## 环境要求
Python >= 3.9 或 Docker
## 许可证
本项目根据 [MIT](https://spdx.org/licenses/MIT.html) 许可证的条款授权。有关完整条款,请参阅 [LICENSE](./LICENSE) 文件。
## 维护者
[CODEOWNERS](./CODEOWNERS)
## 支持
[SUPPORT](./SUPPORT.md)
标签:AI 安全, CodeQL, DevSecOps, Docker, GitHub Security Lab, LLM Agent, MCP Server, Python, SQL, 上游代理, 云安全监控, 代码分析, 任务流, 凭证管理, 变体分析, 安全评估工具, 安全防御评估, 无后门, 沙箱环境, 系统审计, 结构化查询, 自动化安全, 请求拦截, 逆向工具, 静态分析