oracle/macaron

GitHub: oracle/macaron

一款专注于软件供应链安全的分析框架,用于验证构建完整性、检测恶意包并确保 SLSA 合规。

Stars: 187 | Forks: 30

[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-yellow?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) [![conventional-commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow)](https://www.conventionalcommits.org/en/v1.0.0/) [![black](https://img.shields.io/badge/code%20style-black-000000)](https://github.com/psf/black) [![mypy](https://img.shields.io/badge/mypy-checked-brightgreen)](http://mypy-lang.org/) [![pylint](https://img.shields.io/badge/pylint-required%2010.0-brightgreen)](http://pylint.org/) [![pytest](https://img.shields.io/badge/pytest-enabled-brightgreen)](https://github.com/pytest-dev/pytest) [![hypothesis](https://img.shields.io/badge/hypothesis-tested-brightgreen.svg)](https://hypothesis.readthedocs.io/) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/oracle/macaron/badge)](https://github.com/ossf/scorecard) # Macaron ![Macaron](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/21c97e3dd7105940.svg) [完整文档](https://oracle.github.io/macaron/index.html) | [教程](https://oracle.github.io/macaron/pages/tutorials/index.html) | [视频](https://www.youtube.com/watch?v=ebo0kGKP6bw) | [论文](#publications) | [演示文稿](#presentations) | [Macaron GitHub Action](https://oracle.github.io/macaron/pages/macaron_action.html) **Macaron** 是 Oracle Labs 推出的一款软件供应链安全分析工具,专注于验证软件制品及其依赖项的**构建完整性**。它帮助开发者、安全团队和研究人员确保软件包按预期构建且未被篡改。 将 Macaron 作为 GitHub Action 使用 要使用 Macaron GitHub Action,请将以下步骤添加到您的工作流中(根据需要调整版本)。在此示例中,我们使用了一个示例策略。有关详细的说明和可用选项的完整列表,请参阅 [Macaron GitHub Action 文档](https://oracle.github.io/macaron/pages/macaron_action.html)。 ``` - uses: oracle/macaron@v0.22.0 with: repo_path: 'https://github.com/example/project' policy_file: check-github-actions policy_purl: 'pkg:github.com/example/project' output_dir: 'macaron-output' upload_attestation: true ``` 有关详细的说明和可用选项的完整列表,请参阅 [Macaron GitHub Action 文档](https://oracle.github.io/macaron/pages/macaron_action.html)。 ## 关键功能 Macaron 支持: - 针对主流生态系统(如 PyPI、npm 和 Go)中的第三方和内部制品进行**证明验证**,从而实现自动化的来源验证([教程](https://oracle.github.io/macaron/pages/tutorials/provenance.html))。 - 使用可定制的启发式规则,在流行的生态系统中**检测恶意或可疑的软件包**([教程](https://oracle.github.io/macaron/pages/tutorials/detect_malicious_package.html),[博客文章](https://blogs.oracle.com/developers/post/detecting-malicious-behavior-in-software-supply-chain-part-1))。 - **检测存在漏洞的 GitHub Actions**,鉴于近期发生的如 [tj-actions/changed-files](https://www.cve.org/CVERecord?id=CVE-2025-30066) 等现实世界安全事件,这一点变得尤为重要([教程](https://oracle.github.io/macaron/pages/tutorials/detect_vulnerable_github_actions.html))。 - 通过对构建脚本进行静态分析来实现**可重现构建**。Macaron 能够**从源代码重新构建软件包**,并**与已发布的制品进行比对**以检测差异,从而发现受损的工作流或制品([论文](https://arxiv.org/pdf/2410.08427))。 - 对已发布的制品进行**精确的仓库和提交检测**,提高可追溯性和信任度([教程](https://oracle.github.io/macaron/pages/tutorials/source_finder.html))。 ## 演示:分析 Django 及其依赖项 此录屏展示了 Macaron 如何分析 `django@5.0.6` Python 软件包及其依赖项。Macaron 对依赖项运行与 Django 软件包相同的一组检查(包括恶意软件检测)。您可以手动生成软件物料清单 (SBOM),也可以将 Macaron 指向安装了 Django 的虚拟环境,以自动分析整个依赖树。策略引擎确保依赖树中所有软件包的恶意软件检测检查都能通过。 ![Demo](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/33af52f07c105942.gif) ## 基于 SLSA Macaron 遵循 [SLSA (Supply chain Levels for Software Artifacts)](https://slsa.dev) 框架的建议。它提供了一个灵活、可扩展的策略引擎,用于检查与 SLSA 级别的合规性。用户可以定义并组合适合其 CI/CD 实践和安全需求的自定义规则。 ## 支持的构建工具 Macaron 目前支持以下构建工具: - **Java**: Maven, Gradle - **Python**: pip, Poetry - **JavaScript**: npm, Yarn - **Go** - **Docker** ## 应用案例 Macaron 已集成到 [Graal Development Kit (GDK)](https://graal.cloud/gdk/) 中,用于为每个制品生成**验证摘要证明**。这有助于 GDK 用户验证并信任其依赖项的完整性([教程](https://oracle.github.io/macaron/pages/tutorials/use_verification_summary_attestation.html),[博客文章](https://blogs.oracle.com/java/post/announcing-graal-development-kit-for-micronaut-460))。 ## 了解更多 有关支持的技术、CI 提供商和来源格式的完整列表,请参阅[文档](https://oracle.github.io/macaron/pages/supported_technologies/index.html)。 Macaron 正在积极发展中,我们将持续致力于支持更多的生态系统并增强供应链安全能力。 ## 目录 * [入门指南](#getting-started) * [贡献指南](#contributing) * [定义新检查](#defining-new-checks) * [出版物](#publications) * [安全](#security) * [许可证](#license) ## 入门指南 * 要了解如何下载和运行 Macaron,请参阅我们的[文档](https://oracle.github.io/macaron/)。 * 查看我们的[教程](https://oracle.github.io/macaron/pages/tutorials/index.html),了解 Macaron 如何检测软件供应链问题。 * 您还可以观看[此演示](https://www.youtube.com/watch?v=ebo0kGKP6bw)以了解更多关于 Macaron 的信息。 ## 贡献指南 本项目欢迎社区贡献。在提交 Pull Request 之前,请[阅读我们的贡献指南](./CONTRIBUTING.md)。 ## 定义新检查 在克隆仓库后,Macaron 会解析 CI 配置文件以及由 CI 触发的 bash 脚本,并创建调用图和其他中间表示作为抽象。利用这些抽象,Macaron 实现了具体的检查,以根据安全规范收集事实和元数据。 要了解如何定义您自己的检查,请参阅[检查文档](/src/macaron/slsa_analyzer/checks/README.md)中的步骤。 ## 演示文稿 * [使用 Macaron 保护软件供应链:综合分析与保护工具](https://labs.oracle.com/pls/apex/f?p=94065:10:15059068980668:11351),Supply Chain Security Summit 2025。 * [致力于保护软件组件免受供应链攻击](https://labs.oracle.com/pls/apex/f?p=94065:10:117744701900:10830),Chalmers Security & Privacy Lab Seminars 2024。 ## 出版物 * Behnaz Hassanshahi, Trong Nhan Mai, Alistair Michael, Benjamin Selwyn-Smith, Sophie Bates, and Padmanabhan Krishnan: [Macaron: A Logic-based Framework for Software Supply Chain Security Assurance](https://dl.acm.org/doi/abs/10.1145/3605770.3625213), SCORED 2023. Best paper award :trophy: * Behnaz Hassanshahi, Trong Nhan Mai, Benjamin Selwyn-Smith, and Nicholas Allen: [Unlocking Reproducibility: Automating re-Build Process for Open-Source Software](https://arxiv.org/pdf/2509.08204), ASE Industry Showcase 2025. * Ridwan Shariffdeen, Behnaz Hassanshahi, Martin Mirchev, Ali El Husseini, Abhik Roychoudhury [Detecting Python Malware in the Software Supply Chain with Program Analysis](https://labs.oracle.com/pls/apex/f?p=94065:10:11591088449483:11569), ICSE-SEIP 2025. * Jens Dietrich, Tim White, Behnaz Hassanshahi, Paddy Krishnan [Levels of Binary Equivalence for the Comparison of Binaries from Alternative Builds](https://arxiv.org/pdf/2410.08427), ICSME Industry Track 2025. * Jens Dietrich, Tim White, Valerio Terragni, Behnaz Hassanshahi [Towards Cross-Build Differential Testing](https://labs.oracle.com/pls/apex/f?p=94065:10:11591088449483:11549), ICST 2025. * Jens Dietrich, Tim White, Mohammad Mahdi Abdollahpour, Elliott Wen, Behnaz Hassanshahi [BinEq-A Benchmark of Compiled Java Programs to Assess Alternative Builds](https://dl.acm.org/doi/10.1145/3689944.3696162), SCORED 2024. * Jens Dietrich and Behnaz Hassanshahi [DALEQ--Explainable Equivalence for Java Bytecode](https://arxiv.org/pdf/2508.01530), ASE Industry Showcase 2025. ## 安全 请查阅[安全指南](./SECURITY.md)以了解我们的负责任的安全漏洞披露流程。 ## 许可证 Copyright (c) 2022, 2024 Oracle and/or its affiliates. Macaron 根据 [Universal Permissive License (UPL), Version 1.0](./LICENSE.txt) 授权。
标签:CI/CD 安全, DevSecOps, GitHub Action, Oracle Labs, Python, Python 包安全, SBOM, SLSA 合规检查, 上游代理, 云安全监控, 后台面板检测, 安全分析框架, 工件防篡改, 数据投毒防御, 文档安全, 无后门, 日志审计, 暗色界面, 构建完整性验证, 硬件无关, 请求拦截, 跌倒检测, 软件供应链安全, 软件开发工具包, 软件物料清单, 远程方法调用, 逆向工具, 静态分析