Addepar/RedFlag
GitHub: Addepar/RedFlag
RedFlag 利用大语言模型在 CI 流水线或批量模式下自动识别高风险代码变更,帮助团队精准分配安全审查资源。
Stars: 162 | Forks: 10
[][python-url]
[][contributors-url]
[][license-url]
[][linkedin-url][][forks-url] [][stars-url] [][issues-url] RedFlag 利用 AI 来确定高风险的代码变更。 在 batch 模式下运行它,可以界定发布候选版本的手动安全测试范围, 或者在你的 CI pipeline 中运行它,以标记 PR 并添加合适的审查者。 尽管是一款安全工具,RedFlag 几乎可以被任何团队利用, 因为它的配置使其具有无限的灵活性。
阅读博客文章 »
查看示例报告 · 报告 Bug · 请求功能
(返回顶部)
# CI 模式 RedFlag 可以在 CI pipeline 中运行,以标记 PR 并添加合适的审查者。 此模式使用 GitHub Actions 在每个 PR 上运行 RedFlag,并在 该 PR 需要审查时发表评论。此外,CI 模式最适合用于 Slack 告警。 [][docs-ci-mode-url](返回顶部)
# Evaluation 模式 RedFlag 可以在 evaluation 模式下运行,以使用你自己的自定义 数据集来评估 AI 模型的性能。此模式有助于了解模型和 prompt 在你的代码库上的表现,并辅助进行安全 风险评估。 [][docs-eval-mode-url](返回顶部)
# 高级配置 ## 优先级顺序 1. CLI 参数 2. 环境变量 3. 配置文件 4. 默认值 在每次执行时,RedFlag 都会按照上述优先级顺序加载配置,然后 输出一个表格,显示最终的配置以及每个参数的设置位置。 ## 配置选项与默认值 下表显示了每个参数的配置选项: #### 常规设置 | 参数 | CLI 参数 | 环境变量 | 配置文件 | 默认值 | |---------------------------------------------------------------------------------------|-----------|---------|-------------|---------| | [配置文件](https://github.com/Addepar/RedFlag/blob/main/config.sample.yaml) | --config | - | - | - | | 仓库 | --repo | RF_REPO | repo | - | | 起始分支/Commit | --from | RF_FROM | from | - | | 目标分支/Commit | --to | RF_TO | to | - | #### 集成设置 | 参数 | CLI 参数 | 环境变量 | 配置文件 | 默认值 | |-------------------------------------------------------------------------------------------------------------------------------------|------------------|-------------------|---------------|---------| | [GitHub Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) | --github-token | RF_GITHUB_TOKEN | github_token | - | | Jira URL | --jira-url | RF_JIRA_URL | jira.url | - | | Jira 用户名 | --jira-user | RF_JIRA_USER | jira.user | - | | [Jira Token](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/) | --jira-token | RF_JIRA_TOKEN | jira.token | - | | [Slack Token](https://api.slack.com/concepts/token-types) | --slack-token | RF_SLACK_TOKEN | slack.token | - | | [Slack 频道 (ID)](https://slack.com/help/articles/221769328-Locate-your-Slack-URL-or-ID) | --slack-channel | RF_SLACK_CHANNEL | slack.channel | - | | Slack 消息标题 | --slack-headline | RF_SLACK_HEADLINE | slack.headline | - | #### LLM 设置 | 参数 | CLI 参数 | 环境变量 | 配置文件 | 默认值 | |--------------------------------------------------------------------------------------------------------------------|--------------------|---------------------|----------------------------|-------------------------------------------| | 调试 LLM | --debug-llm | - | - | `False` | | [Bedrock 模型 ID](https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html) | --bedrock-model-id | RF_BEDROCK_MODEL_ID | bedrock.model_id | `anthropic.claude-3-sonnet-20240229-v1:0` | | [Bedrock Profile](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-files.html) | --bedrock-profile | RF_BEDROCK_PROFILE | bedrock.profile | - | | [Bedrock Region](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html) | --bedrock-region | RF_BEDROCK_REGION | bedrock.region | - | | 审查 Prompt (角色) | - | - | prompts.review.role | 安全审查(见 `sample.config.yaml`) | | 审查 Prompt (问题) | - | - | prompts.review.question | 安全审查(见 `sample.config.yaml`) | | 测试计划 Prompt (角色) | - | - | prompts.test_plan.role | 安全审查(见 `sample.config.yaml`) | | 测试计划 Prompt (问题) | - | - | prompts.test_plan.question | 安全审查(见 `sample.config.yaml`) | #### 输入/输出设置 | 参数 | CLI 参数 | 环境变量 | 配置文件 | 默认值 | |---------------------------|--------------------------|----------------|-------------------------|-----------| | 输出目录 | --output-dir | RF_OUTPUT_DIR | output_dir | `results` | | 最大 Commit 数量 | --max-commits | RF_MAX_COMMITS | max_commits | `0` (∞) | | 不输出 HTML | --no-output-html | - | - | - | | 不输出 JSON | --no-output-json | - | - | - | | 不显示进度条 | --no-progress-bar | - | - | - | | 不移除 HTML 注释 | --no-strip-html-comments | - | - | - | | 过滤 Commit 标题 | - | - | filter_commits.title | - | | 过滤 Commit 用户 | - | - | filter_commits.user | - | | 移除描述行 | - | - | strip_description_lines | - | #### Evaluation 参数(`eval` 命令) | 参数 | CLI 参数 | 环境变量 | 配置文件 | 默认值 | |---------------------------------------------------------------------------------------------------------|------------|------------------|--------------|---------| | [Evaluation 数据集](https://github.com/Addepar/RedFlag/wiki/Evaluation-Mode#building-a-custom-dataset) | --dataset | RF_DATASET | dataset | - |(返回顶部)
## 许可证 基于 MIT License 分发。查看 [`LICENSE.md`](https://github.com/Addepar/RedFlag?tab=MIT-1-ov-file#readme) 了解更多信息。(返回顶部)
## 联系方式 通过 [security-engineering@addepar.com](mailto:security-engineering@addepar.com) 与 Addepar Security Engineering 打个招呼。(返回顶部)
标签:DevSecOps, Python, 上游代理, 云安全监控, 人工智能, 代码审查, 无后门, 用户模式Hook绕过, 逆向工具, 静态分析