afuckingco/secure-ci-pipeline
GitHub: afuckingco/secure-ci-pipeline
基于 GitHub Actions 的多技术栈 CI/CD 安全扫描流水线,自动执行依赖漏洞检测、密钥泄露扫描和网络入侵检测并生成聚合报告。
Stars: 0 | Forks: 0
# 安全 CI Pipeline
一个用于多技术栈项目(Node/JavaScript、Python、通用源代码和网络流量)的**全自动 CI/CD 安全扫描流水线**。该工作流在每次推送到 `main` 分支以及每次 pull-request 时运行,生成详尽的 Markdown 报告,并支持可选的 Slack 通知。
## 功能
- **依赖项漏洞扫描**
- `npm audit` → 检测 `package.json` 依赖项中的已知问题。
- `pip-audit` → 检查 `requirements.txt` 中的 PyPI 包。
- 使用 **Gitleaks** 进行**密钥检测**(内置二进制文件,无需外部安装)。
- 在 Docker 内部使用 **Suricata** 进行**网络层 IDS** – 验证容器不会暴露易受攻击的流量模式。
- **聚合报告**(`security_report.md`)包含 JSON 片段,方便快速分类排查。
- 集成 **GitHub Actions** – 对大多数仓库实现零配置。
- 支持 **Slack webhook**(将 token 存储在 `SLACK_WEBHOOK` secret 中)。
- **Artifacts** – 报告将作为构建产物上传并存档。
## 快速开始(本地测试)
```
# Clone the repository
git clone https://github.com/afuckingco/secure-ci-pipeline.git
cd secure-ci-pipeline
# 安装 Python 依赖 (pip‑audit) – 对于本地测试,Node 依赖是可选的
pip install -r requirements.txt
# Run the individual scan scripts
./scripts/run_pip_audit.sh # → pip_audit.json
./scripts/run_gitleaks.sh # → gitleaks.json (binary bundled)
# Suricata 必须运行 Docker
./scripts/run_suricata.sh # → suricata/log/evts.json
# 将所有内容合并为单个报告
./scripts/aggregate_report.py
cat security_report.md
```
## GitHub Actions 工作流
该流水线定义在 `.github/workflows/security-scan.yml` 中。它会自动:
1. 检出代码。
2. 设置 Node 20 和 Python 3.11 环境。
3. 安装所需的依赖项。
4. 执行四个扫描脚本。
5. 汇总结果。
6. 将 Markdown 作为 artifact 上传。
7. (可选)发送格式化的 Slack 消息。
## 配置
| 项目 | 描述 | 默认值 |
|------|-------------|---------|
| `SLACK_WEBHOOK` (secret) | 用于通知的 Slack incoming webhook URL。 | *未设置*(跳过通知) |
| Suricata Docker image | 使用 `jasonish/suricata:latest`。可通过编辑 `scripts/run_suricata.sh` 进行覆盖。 |
| Gitleaks binary | 内置于 `bin/gitleaks.exe`。如有需要,可替换为新版本。 |
## 发布历史
### v1.0.0 – 2026-07-12
- **Secure CI Pipeline** 首次发布。
- 包含所有扫描脚本、基于 Docker 的 Suricata、内置的 Gitleaks 二进制文件以及 GitHub Actions 工作流。
- 添加了专业的 README、`.gitignore` 和 CI 文档。
## 许可证
MIT © 2026 Afiq Andico — 个人和商业用途均可免费使用。
标签:CISA项目, DevSecOps, Metaprompt, MITM代理, StruQ, 上游代理, 结构化查询, 自动化安全, 请求拦截, 逆向工具