harekrishnarai/flowlyt
GitHub: harekrishnarai/flowlyt
一款 AI 增强的 CI/CD 工作流安全分析器,专门检测 GitHub Actions 和 GitLab CI 中的恶意模式、配置错误和密钥泄露。
Stars: 15 | Forks: 5


🔒 使用 Flowlyt 保护您的 CI/CD 流水线
⭐ 在 GitHub 上给我们点个 Star
# Flowlyt - AI 驱动的多平台 CI/CD 安全分析器
**针对 GitHub Actions 和 GitLab CI/CD 工作流的高级安全分析器,具备 AI 增强的误报检测功能**
Flowlyt 将传统的模式匹配与前沿的抽象语法树 (AST) 分析及 **AI 驱动的验证**相结合,实现了扫描速度提升 **62%**,误报减少 **66%**。已入选 DEF CON 33 和 Black Hat Europe 2025 演讲项目。
## 🤖 AI 驱动的安全分析
**🔑 自带密钥 (BYOK) 模式** - 使用您首选的 AI 提供商和自己的 API 密钥,以增强隐私和管控。
### 支持的 AI 提供商
- **OpenAI** (GPT-4, GPT-4o, GPT-4o-mini) - 通用安全分析
- **Google Gemini** (1.5 Pro, 1.5 Flash) - 快速、高性价比的分析
- **Anthropic Claude** (3 Opus, 3 Sonnet, 3 Haiku) - 详细的推理和细致入微的分析
- **xAI Grok** (Beta) - 另类分析视角
- **Perplexity** (Llama 3.1 Sonar, GPT-4o) - 实时网络增强分析
### AI 增强功能
- 🎯 **误报检测** - AI 区分真实威胁和配置噪音
- 🧠 **上下文感知分析** - 理解 CI/CD 模式和合法使用场景
- 🔒 **供应链安全聚焦** - 专注于 GitHub Actions 加固和 Runner 安全
- ⚡ **实时验证** - 对安全发现进行即时 AI 分析
- 📊 **置信度评分** - AI 为每项评估提供置信度水平 (0-100%)
## 🎯 上下文感知分析 (新功能!)
**基于工作流上下文的智能严重性调整** - 实现了 **50-60% 的误报减少**
### 工作原理
- 🔍 **工作流意图检测** - 自动分类工作流(测试、部署、发布)
- 🛡️ **触发器风险评估** - 根据工作流触发器评估风险 (pull_request_target = 严重, schedule = 低)
- 🔐 **权限分析** - 检测实际权限需求与授予权限的差异
- 📊 **动态严重性调整** - 根据上下文调整发现结果的严重性
### 结果
```
Before Context-Aware: 60-70% false positive rate
After Context-Aware: 10-15% false positive rate ✅
Test Workflows: Appropriate downgrading (HIGH → MEDIUM)
Release Workflows: Maintains strict security standards
Critical Issues: 100% preserved (zero false negatives)
```
**有关主要开源项目的详细分析,请参阅 [CONTEXT_AWARE_SUMMARY_TABLE.md](CONTEXT_AWARE_SUMMARY_TABLE.md)。**
## ✨ 主要特性
- 🤖 **AI 驱动分析** - 支持 OpenAI、Gemini、Claude 和 Grok 的 BYOK 模式
- 🎯 **基于 AST 的分析** - 调用图、可达性和数据流分析
- 🚀 **多平台** - 支持 GitHub Actions + GitLab CI/CD
- 🛡️ **85+ 安全规则** - 涵盖注入、机密信息、供应链、配置错误
- 🧠 **误报减少** - AI 区分真实威胁与配置噪音
- 📊 **SARIF 输出** - 集成 GitHub Security 标签页
- ⚙️ **可配置** - 自定义规则、策略和忽略模式
- 🔄 **实时情报** - 集成 OSV.dev 漏洞数据库
## 🚀 快速入门
## 安装
直接安装最新版本:
```
# 安装特定最新版本
go install github.com/harekrishnarai/flowlyt/cmd/flowlyt@latest
```
直接安装特定版本:
```
# 安装特定最新版本
go install github.com/harekrishnarai/flowlyt/cmd/flowlyt@v1.0.8
```
**验证**:检查您是否拥有正确的版本:
```
flowlyt --version
# 应输出:flowlyt version 1.0.8
```
### 🤖 AI 驱动分析设置
```
# 设置您的 AI API key (BYOK 模式)
export AI_API_KEY=your-api-key
# 使用 AI 驱动的误报检测进行扫描
flowlyt scan ./my-repo --ai openai
flowlyt scan ./my-repo --ai gemini
flowlyt scan ./my-repo --ai claude
flowlyt scan ./my-repo --ai grok
flowlyt scan ./my-repo --ai perplexity
# 高级 AI 配置
flowlyt scan ./my-repo \
--ai openai \
--ai-model gpt-4 \
--ai-workers 10 \
--ai-timeout 60
```
### 已认证的远程扫描 (GitHub/GitLab)
对 GitHub/GitLab 的未经认证 API 调用有严格的速率限制。为了可靠的 `--url` 扫描,请通过环境变量或 CLI 标志提供 Token。
```
# GitHub:使用环境变量
export GITHUB_TOKEN=ghp_your_token_here
flowlyt scan --url https://github.com/step-security/github-actions-goat \
--output json --output-file results.json
# GitHub:或通过 flag (覆盖 env)
flowlyt scan --url https://github.com/step-security/github-actions-goat \
--github-token ghp_your_token_here \
--output json --output-file results-with-token.json
# GitLab:SaaS 或 self-hosted
export GITLAB_TOKEN=glpat_your_token_here
flowlyt scan --platform gitlab \
--url https://gitlab.com/owner/repo \
--gitlab-token glpat_your_token_here
```
### 🔑 API 密钥设置 (BYOK)
| 提供商 | 获取 API 密钥 | 环境变量 |
|----------|-------------|---------------------|
| **OpenAI** | [platform.openai.com](https://platform.openai.com/api-keys) | `AI_API_KEY` |
| **Gemini** | [aistudio.google.com](https://aistudio.google.com/app/apikey) | `AI_API_KEY` |
| **Claude** | [console.anthropic.com](https://console.anthropic.com/) | `AI_API_KEY` |
| **Grok** | [console.x.ai](https://console.x.ai/) | `AI_API_KEY` |
| **Perplexity** | [perplexity.ai](https://www.perplexity.ai/settings/api) | `AI_API_KEY` |
## 📊 示例输出
### 传统扫描
```
🔍 Analyzing: .github/workflows/ci.yml
⚡ AST Analysis: ON (62% faster, 66% fewer false positives)
🚨 CRITICAL: Shell Injection via curl | bash
└─ Line 23: curl -sSL https://get.docker.com/ | sh
└─ Risk: Remote code execution, supply chain attack
🔥 HIGH: Hardcoded Secret Detected
└─ Line 15: API_KEY="sk-1234567890abcdef"
└─ Risk: Credential exposure in version control
✅ Scan completed in 28ms
Found 2 issues (1 Critical, 1 High, 0 Medium, 0 Low)
```
### 🤖 AI 增强扫描输出
```
🔍 Analyzing: .github/workflows/ci.yml
⚡ AST Analysis: ON | 🤖 AI Analysis: gemini
🔍 Analyzing 12 findings with AI...
✅ AI Analysis Complete:
- Successfully analyzed: 12/12 findings
- Likely false positives: 8
- Likely true positives: 4
- High confidence: 10, Medium: 2, Low: 0
🚨 CRITICAL: Shell Injection via curl | bash
└─ Line 23: curl -sSL https://get.docker.com/ | sh
└─ Risk: Remote code execution, supply chain attack
🤖 AI Analysis: Likely TRUE POSITIVE (95% confidence)
AI Reasoning: This is a classic supply chain attack vector. The script downloads
and executes code directly from an external source without verification...
🔥 HIGH: Hardcoded Secret Detected
└─ Line 15: API_KEY="sk-1234567890abcdef"
└─ Risk: Credential exposure in version control
🤖 AI Analysis: Likely FALSE POSITIVE (90% confidence)
AI Reasoning: This appears to be a placeholder value commonly used in
documentation and examples, not an actual secret...
✅ Scan completed in 1.2s
Found 4 real issues (1 Critical, 1 High, 2 Medium) | 8 false positives filtered by AI
```
## 🔧 GitHub Actions 集成
### 基础工作流扫描
```
name: Security Scan
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
permissions:
security-events: write # Required for SARIF upload
contents: read
steps:
- uses: actions/checkout@v4
- name: Run Flowlyt Security Scan
uses: harekrishnarai/flowlyt@v1.0.8
with:
output-format: 'sarif'
output-file: 'flowlyt-results.sarif'
min-severity: 'MEDIUM'
fail-on-severity: 'HIGH'
- name: Upload to GitHub Security
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: flowlyt-results.sarif
category: flowlyt
```
### 包含 AST 与漏洞情报的高级配置
```
- name: Advanced Flowlyt Scan
uses: harekrishnarai/flowlyt@v1.0.8
with:
config-file: '.flowlyt.yml'
output-format: 'sarif'
output-file: 'flowlyt-results.sarif'
enable-ast-analysis: true # Enable AST-based analysis
enable-vuln-intel: true # Enable OSV.dev vulnerability intelligence
enable-policy-enforcement: true # Enable enterprise policy checks
min-severity: 'LOW'
fail-on-severity: 'CRITICAL'
verbose: true
- name: Upload Results
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: flowlyt-results.sarif
```
## 📚 文档
| 主题 | 描述 |
|-------|-------------|
| [快速入门](docs/quick-start.md) | 安装与基本用法 |
| [🤖 AI 集成](docs/ai-integration.md) | **AI 驱动分析的设置与配置** |
| [功能特性](docs/features.md) | 完整功能概览 |
| [AST 分析](docs/ast-analysis.md) | 高级静态分析能力 |
| [配置指南](docs/configuration.md) | 详细配置指南 |
| [安全规则](docs/security-rules.md) | 完整规则参考 |
| [自定义规则](docs/custom-rules.md) | 创建自定义安全规则 |
| [CLI 参考](docs/cli-reference.md) | 命令行选项 |
## 🤖 为什么选择 AI 驱动分析?
### 传统安全扫描器 vs Flowlyt AI
| 挑战 | 传统方法 | 🤖 Flowlyt AI 解决方案 |
|-----------|---------------------|----------------------|
| **误报** | 高噪点,需人工审查 | AI 自动过滤 60-80% 的误报 |
| **上下文理解** | 仅模式匹配 | 理解 CI/CD 上下文及合法模式 |
| **供应链聚焦** | 通用安全规则 | 专注于 GitHub Actions 加固与 Runner 安全 |
| **分类时间** | 数小时的人工分析 | 即时 AI 评估并附带置信度评分 |
| **可操作性** | 原始发现堆砌 | 语境化解释及严重性建议 |
### 🔒 隐私与安全 (BYOK 模式)
- **您的密钥,您的掌控** - 在任何支持的提供商中使用您自己的 API 密钥
- **无数据存储** - 发现结果实时分析,不被 AI 提供商存储
- **透明成本** - 使用您自己的账户,仅为您的实际使用量付费
- **提供商选择** - 随时在 OpenAI、Gemini、Claude 或 Grok 之间切换
## 🚀 路线图
- [x] **SARIF 输出** - GitHub Security 标签页集成
- [x] **AST 分析** - 调用图、可达性、数据流
- [x] **多平台** - GitHub Actions + GitLab CI/CD
- [x] **🤖 AI 驱动分析** - 支持多提供商的 BYOK 模式
- [x] **误报减少** - AI 增强的准确性和上下文感知
- [ ] **IDE 扩展** - 具备 AI 功能的 VS Code 实时分析
- [ ] **工作流可视化** - 安全依赖图
- [ ] **企业功能** - SSO、RBAC、合规性报告
- [ ] **AI 模型训练** - 针对组织特定模式的自定义模型
## 🤝 贡献
我们欢迎贡献!请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 了解指南。
## 📄 许可证
Apache License 2.0 - 详见 [LICENSE](LICENSE)。
## 🎯 准备好尝试 AI 驱动的安全分析了吗?
### 🚀 AI 快速入门(3 步)
```
# 1. 安装 Flowlyt
go install github.com/harekrishnarai/flowlyt/cmd/flowlyt@latest
# 2. 获取您的 API key (选择一个):
# - OpenAI:https://platform.openai.com/api-keys
# - Gemini:https://aistudio.google.com/app/apikey
# - Claude:https://console.anthropic.com/
# - Grok:https://console.x.ai/
# - Perplexity:https://www.perplexity.ai/settings/api
# 3. 运行 AI 增强扫描
export AI_API_KEY=your-api-key
flowlyt scan ./your-repo --ai gemini
```
### 💡 团队选择 Flowlyt AI 的原因
- **🎯 减少 60-80% 的误报** - 专注于真实威胁,而非噪音
- **⚡ 即时分类** - AI 在数秒内解释发现结果的重要性
- **🔒 供应链聚焦** - 专为 GitHub Actions 和 CI/CD 安全打造
- **💰 高性价比** - 基于 BYOK 模式,仅按需付费
- **🛡️ 隐私至上** - 您的密钥,您的数据,您做主
**会议演讲:**
- 🎯 [DEF CON 33 - AppSec Village](https://defcon.org) (已演讲)
- 🔥 [Black Hat Europe 2025](https://blackhat.com) (即将到来)
## 贡献者
感谢所有已经做出贡献的人!
[Hare Krishna Rai](https://www.linkedin.com/in/harekrishnarai/)
[Gaurav Joshi](https://www.linkedin.com/in/gauravjoshii/)
[Chanchal Kalnarayan](https://www.linkedin.com/in/ckalnarayan)
[Prashant Venkatesh](https://www.linkedin.com/in/prashant-venkatesh-99018999/)
[Nandan Gupta](https://www.linkedin.com/in/nandan-gupta-698aa11b)
[Mohd. Arif](https://www.linkedin.com/in/mohd--arif/)
⭐ 在 GitHub 上给我们点个 Star
标签:CI/CD安全, Claude, CVE检测, DevSecOps, DLL 劫持, EVTX分析, EVTX分析, Gemini, GitHub Actions, GitLab CI, Llama, OpenAI, Petitpotam, Python, SAST, StruQ, 上游代理, 人工智能, 内存规避, 图计算, 大语言模型, 安全助手, 工作流安全, 恶意模式检测, 文档安全, 无后门, 日志审计, 用户模式Hook绕过, 盲注攻击, 自动笔记, 误报检测, 软件开发工具包, 配置错误检测, 错误基检测, 静态代码分析