Crynge/ci-cd-supply-chain-guardian

GitHub: Crynge/ci-cd-supply-chain-guardian

针对 GitHub Actions 和软件包发布管道供应链风险的扫描与防御平台,聚焦 workflow 配置缺陷与发布链路信任边界的安全审计。

Stars: 0 | Forks: 0

# CI/CD 供应链卫士 ![仪表盘截图](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/c696c1b797014013.png) ![完整报告截图](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/868a19392c014015.png) ![攻击路径截图](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/04e7cba5f6014016.png) **CI/CD 供应链卫士** 是一个从防御研究到运行时的全链路平台,围绕 **2026 年 5 月 8 日** GitHub 和代码世界中最复杂且活跃的问题而构建:即 GitHub Actions 和软件包发布管道的沦陷。 它通过扫描 GitHub workflow 文件、release job、publish 通道、package install 钩子以及容器来源界面,来识别导致 2026 年 CI/CD 供应链攻击浪潮的确切故障模式。 ## 为什么会有这个仓库 目前的一手报告都指向一个残酷的事实: - 攻击者正在将目标对准 **CI/CD 自动化本身** - 可变的 workflow 依赖和 tag 重指向依然普遍存在 - 静态的 registry secret 仍然被硬编码在 release workflow 中 - 恶意的 package 钩子能将单一的沦陷转化为下游的传播 本仓库将这一现实转化为一个可运行的系统,包含: - 用于扫描 GitHub Actions 和 package 表面的 Python 扫描器引擎 - FastAPI 控制平面 - 用于风险分诊和攻击路径审查的 React 仪表盘 - 两个模拟仓库:一个被故意植入漏洞,一个经过安全加固 - JSON 和 HTML 报告打包生成 ## 它能检测什么 - 未绑定至完整 SHA 的可变第三方 action 引用 - `pull_request_target` 暴露风险 - 过宽的 `GITHUB_TOKEN` 写入权限范围 - `actions/checkout` 凭证持久化问题 - 使用不受信的 GitHub event 字段引发的 shell 注入 - `curl | bash` 风格的引导模式 - 使用长期有效的 registry secret 而非 OIDC / trusted publishing 的 publish job - npm `preinstall` / `postinstall` 钩子 - 未按摘要 (digest) 绑定的 Docker `FROM` 镜像 ## 仓库结构 ``` ci-cd-supply-chain-guardian/ |-- apps/ | |-- api/ # FastAPI control plane | `-- web/ # React + Vite dashboard |-- docs/ # Problem brief, architecture, audit, screenshots |-- fixtures/ # Risky and hardened sample repos |-- reports/generated/ # JSON + HTML scan bundles |-- src/chain_guardian/ # Scanner, research, fixtures, reporting, CLI |-- tests/ # Pytest + browser smoke `-- tools/ # Report generation helpers ``` ## 快速开始 ### 1. 安装 Python 依赖 ``` python -m pip install -r requirements.txt ``` ### 2. 安装前端依赖 ``` npm run install:web ``` ### 3. 生成测试数据报告 ``` python tools/generate_reports.py ``` ### 4. 运行 API ``` python -m uvicorn apps.api.app.main:app --host 127.0.0.1 --port 8010 ``` ### 5. 运行仪表盘 ``` npm run dev --prefix apps/web ``` ## CLI 使用方法 扫描本地仓库路径: ``` python -m chain_guardian scan /path/to/repo --json ``` 扫描内置的测试数据并输出 HTML + JSON 结果: ``` python -m chain_guardian fixture team-pcp-style --write ``` ## 研究基础 本仓库中的问题框架基于 2026 年 5 月的当前信号: - [GitHub Actions 2026 安全路线图](https://github.blog/news-insights/product-news/whats-coming-to-our-github-actions-2026-security-roadmap/) - [在整个 GitHub 上保障开源供应链的安全](https://github.blog/security/supply-chain-security/securing-the-open-source-supply-chain-across-github/) - [微软关于 Trivy 沦陷事件的报告](https://www.microsoft.com/en-us/security/blog/2026/03/24/detecting-investigating-defending-against-trivy-supply-chain-compromise/) - [GitHub 文档:安全使用参考](https://docs.github.com/actions/security-guides/security-hardening-for-github-actions?learn=getting_started) - [GitHub 文档:PyPI 中的 OIDC](https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-pypi) - [The Register 关于 Mini Shai-Hulud 浪潮的报道](https://www.theregister.com/security/2026/05/01/ongoing-supply-chain-attacks-worm-into-sap-npm-packages/5228837) 更多细节记录在 [docs/problem-brief.md](/C:/Users/samee/Documents/Codex/2026-04-23-please-create-a-github-repo-to/ci-cd-supply-chain-guardian/docs/problem-brief.md) 中。
标签:AV绕过, CI/CD安全, CI/CD攻击防护, DevSecOps, Docker安全, FastAPI, GitHub Actions, GitHub Token, Llama, OIDC, Python, React, StruQ, Syscalls, URL发现, Vite, Web截图, 上游代理, 代码安全, 代码注入防御, 供应链攻击防护, 包管理器安全, 安全合规, 安全控制台, 安全检测, 容器安全, 工作流安全, 开源框架, 持续交付, 持续集成, 攻击路径分析, 无后门, 流水线安全, 漏洞枚举, 结构化查询, 网络代理, 网络安全, 自动化安全, 自动笔记, 跌倒检测, 软件开发工具包, 软件物料清单, 逆向工具, 防御平台, 隐私保护