AurelienKumarathas/devsecops-pipeline-project-1

GitHub: AurelienKumarathas/devsecops-pipeline-project-1

一个生产级的 DevSecOps 流水线项目,通过自动化安全扫描在代码进入生产前发现并阻断漏洞。

Stars: 0 | Forks: 0

# 🔐 DevSecOps 流水线 — NexusCore Technologies ![DevSecOps Pipeline](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/50c4139cc1222741.svg) ![GitHub Actions](https://img.shields.io/badge/CI%2FCD-GitHub%20Actions-2088FF?style=flat&logo=githubactions&logoColor=white) ![AWS](https://img.shields.io/badge/Cloud-AWS-FF9900?style=flat&logo=amazonaws&logoColor=white) ![CodeQL](https://img.shields.io/badge/SAST-CodeQL-6F42C1?style=flat) ![Trivy](https://img.shields.io/badge/SCA-Trivy-1904DA?style=flat&logo=aqua&logoColor=white) ![Gitleaks](https://img.shields.io/badge/Secrets-Gitleaks-red?style=flat) ![License](https://img.shields.io/badge/License-MIT-green?style=flat) ## 📊 流水线结果 | 阶段 | 工具 | 状态 | 发现 | |------|------|------|------| | SAST — 静态分析 | CodeQL | ✅ 通过 | 检测到 SQL 注入、命令注入、模板注入并已上报 | | SCA — 依赖扫描 | Trivy | 🔴 故意失败 | PyYAML 5.4.1 中存在 CVE-2020-14343(严重);Flask 2.0.1 存在多个漏洞 | | IaC 安全 | Trivy IaC | 🔴 故意失败 | S3 存储桶未加密;安全组规则过于宽松 | | 密钥检测 | Gitleaks | 🔴 故意失败 | 检测到硬编码密钥:`hashicorp-tf-password` 和 `generic-api-key` | | 容器安全 | Trivy Image | ⏭️ 跳过 | 仅在 Docker 镜像构建成功时运行 | | 安全汇总 | GitHub Actions | ✅ 通过 | 完整 SARIF 报告已上传至 GitHub 安全页面 | ## 📸 流水线实际运行 ![Pipeline Screenshot](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/916a584147222742.png) *GitHub Actions 实时运行画面,展示 CodeQL 通过、Gitleaks 捕获硬编码密钥(附带提交 SHA、文件路径与行号),以及完整 SARIF 上传至安全页面。* ## 💼 业务背景 - **客户**:NexusCore Technologies(虚构 — 用于作品集展示) - **领域**:金融科技 — 支付处理 - **挑战**:Q3 发生 3 起安全事件,投资人要求在 B 轮融资前改善安全态势 - **解决方案**:左移安全策略 — 在每个 CI/CD 阶段嵌入自动化扫描,确保漏洞在进入生产前被捕获 - **成果**:每次提交在部署前均需通过 5 道安全关卡 ## 🛠️ 安全工具 | 工具 | 用途 | 阶段 | |------|------|------| | **CodeQL** | 静态应用程序安全测试(SAST) | 构建 | | **Trivy** | 依赖与容器扫描(SCA) | 构建 | | **Gitleaks** | 密钥检测 | 预提交 / CI | | **Trivy IaC** | 基础设施即代码安全 | 构建 | | **GitHub 安全页面** | SARIF 漏洞报告 | 扫描后 | ## 🏗️ 架构 ``` graph LR A[Developer Push] --> B[GitHub Actions] B --> C[SAST - CodeQL] B --> D[SCA - Trivy] B --> E[Secret Scan - Gitleaks] B --> F[IaC Scan - Trivy] C --> G[Docker Build] D --> G E --> G F --> G G --> H[AWS Deployment] C --> I[SARIF Upload] D --> I I --> J[GitHub Security Tab] ``` ## 🔍 故意引入的漏洞(教学用途) 本仓库包含故意不安全的代码,用于验证各安全关卡是否正常工作: ### SAST(CodeQL) - 用户查询函数中的 SQL 注入 - 端点中的命令注入 - 服务器端模板注入(SSTI) ### SCA(Trivy) - `CVE-2020-14343`(PyYAML 5.4.1)— **严重** - Flask 2.0.1 中的多个漏洞 ### IaC(Trivy) - 未启用服务器端加密的 S3 存储桶 - 允许 `0.0.0.0/0` 入口规则的安全组 ### 密钥检测(Gitleaks) - `terraform/main.tf` 中的伪造 `hashicorp-tf-password` - `src/vulnerable_app.py` 中的伪造 `generic-api-key` ## ⚡ 快速开始 ``` git clone https://github.com/AurelienKumarathas/devsecops-pipeline-project-1.git cd devsecops-pipeline-project-1 # Push any change to trigger the full security pipeline git commit --allow-empty -m "trigger pipeline" git push # View scan results in the Actions tab and Security tab on GitHub ``` ## 💼 展示技能 | 技能 | 工具 | 相关性 | |------|------|--------| | CI/CD 流水线设计 | GitHub Actions | 自动化安全关卡 | | SAST | CodeQL | 静态代码漏洞检测 | | SCA | Trivy | 依赖与容器扫描 | | 密钥检测 | Gitleaks | 预提交密钥防护 | | IaC 安全 | Trivy IaC | Terraform 配置错误扫描 | | 容器安全 | Docker + Trivy | 安全镜像最佳实践 | | 漏洞报告 | SARIF + GitHub 安全 | 集中式发现管理 | | 云基础设施 | AWS | 生产级 Terraform 模块 | ## 📄 许可证 MIT — 详见 [许可证文件](LICENSE)。
标签:AWS, CodeQL, CVE, DevSecOps, DPI, EC2, Fintech, GitHub Actions, Gitleaks, IaC, S3安全, SARIF, SAST, SSTI, 上游代理, 代码安全, 命令注入, 安全合规, 安全左移, 安全组, 安全评估工具, 开源框架, 持续交付, 持续集成, 支付处理, 数字签名, 漏洞利用检测, 漏洞枚举, 盲注攻击, 秘密扫描, 结构化查询, 网络代理, 自动化安全, 自动笔记, 静态应用安全测试