|
| 1 | +# Copyright (c) 2025 - 2025, Oracle and/or its affiliates. All rights reserved. |
| 2 | +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. |
| 3 | + |
| 4 | +name: Test Macaron Action (tutorials) |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + paths: |
| 9 | + - action.yaml |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - action.yaml |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +permissions: |
| 16 | + id-token: write |
| 17 | + attestations: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + tutorial-commit-finder: |
| 21 | + name: Analyzing and comparing different versions of an artifact |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 25 | + |
| 26 | + - name: Run Macaron (analyze arrow@1.3.0) |
| 27 | + uses: ./ |
| 28 | + with: |
| 29 | + package_url: pkg:pypi/arrow@1.3.0 |
| 30 | + output_dir: macaron_output/commit_finder |
| 31 | + |
| 32 | + - name: Run Macaron (analyze arrow@0.15.0) |
| 33 | + uses: ./ |
| 34 | + with: |
| 35 | + package_url: pkg:pypi/arrow@0.15.0 |
| 36 | + output_dir: macaron_output/commit_finder |
| 37 | + |
| 38 | + - name: Run Macaron (verify policy - has-hosted-build) |
| 39 | + uses: ./ |
| 40 | + with: |
| 41 | + policy_file: ./tests/tutorial_resources/commit_finder/has-hosted-build.dl |
| 42 | + output_dir: macaron_output/commit_finder |
| 43 | + |
| 44 | + tutorial-detect-malicious-package: |
| 45 | + name: Detecting malicious packages |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 49 | + - name: Run Macaron (analyze django@5.0.6 without dependencies) |
| 50 | + uses: ./ |
| 51 | + with: |
| 52 | + package_url: pkg:pypi/django@5.0.6 |
| 53 | + output_dir: macaron_output/detect_malicious_package |
| 54 | + |
| 55 | + - name: Run Macaron (verify policy - check-django) |
| 56 | + uses: ./ |
| 57 | + with: |
| 58 | + policy_file: ./tests/tutorial_resources/detect_malicious_package/check-django.dl |
| 59 | + output_dir: macaron_output/detect_malicious_package |
| 60 | + |
| 61 | + - name: Setup Python for analyzed venv |
| 62 | + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 63 | + with: |
| 64 | + python-version: 3.11.13 |
| 65 | + |
| 66 | + - name: Create and populate analyzed venv |
| 67 | + run: | |
| 68 | + python -m venv /tmp/.django_venv |
| 69 | + source /tmp/.django_venv/bin/activate |
| 70 | + pip install --upgrade pip |
| 71 | + pip install django==5.0.6 |
| 72 | + shell: bash |
| 73 | + |
| 74 | + - name: Clean previous macaron output |
| 75 | + run: | |
| 76 | + rm -rf macaron_output/detect_malicious_package |
| 77 | + shell: bash |
| 78 | + |
| 79 | + - name: Run Macaron (analyze django@5.0.6 with direct dependencies) |
| 80 | + uses: ./ |
| 81 | + with: |
| 82 | + package_url: pkg:pypi/django@5.0.6 |
| 83 | + output_dir: macaron_output/detect_malicious_package |
| 84 | + deps_depth: '1' |
| 85 | + python_venv: /tmp/.django_venv |
| 86 | + |
| 87 | + - name: Run Macaron (verify policy - check-dependencies) |
| 88 | + uses: ./ |
| 89 | + with: |
| 90 | + policy_file: ./tests/tutorial_resources/detect_malicious_package/check-dependencies.dl |
| 91 | + output_dir: macaron_output/detect_malicious_package |
| 92 | + |
| 93 | + tutorial-detect-vulnerable-actions: |
| 94 | + name: How to detect vulnerable GitHub Actions |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 98 | + |
| 99 | + - name: Run Macaron (analyze repo - apache/logging-log4j2) |
| 100 | + uses: ./ |
| 101 | + with: |
| 102 | + repo_path: https://github.com/apache/logging-log4j2 |
| 103 | + output_dir: macaron_output/detect_vulnerable_github_actions |
| 104 | + |
| 105 | + - name: Run Macaron (verify policy - github_actions_vulns for repo) |
| 106 | + uses: ./ |
| 107 | + with: |
| 108 | + policy_file: ./tests/tutorial_resources/detect_vulnerable_github_actions/check_github_actions_vuln_repo.dl |
| 109 | + output_dir: macaron_output/detect_vulnerable_github_actions |
| 110 | + |
| 111 | + - name: Run Macaron (analyze purl - log4j-core example) |
| 112 | + uses: ./ |
| 113 | + with: |
| 114 | + package_url: pkg:maven/org.apache.logging.log4j/log4j-core@3.0.0-beta3 |
| 115 | + output_dir: macaron_output/detect_vulnerable_github_actions |
| 116 | + |
| 117 | + - name: Run Macaron (verify policy - github_actions_vulns for purl) |
| 118 | + uses: ./ |
| 119 | + with: |
| 120 | + policy_file: ./tests/tutorial_resources/detect_vulnerable_github_actions/check_github_actions_vuln_purl.dl |
| 121 | + output_dir: macaron_output/detect_vulnerable_github_actions |
| 122 | + |
| 123 | + tutorial-provenance: |
| 124 | + name: Provenance discovery, extraction, and verification |
| 125 | + runs-on: ubuntu-latest |
| 126 | + steps: |
| 127 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 128 | + - name: Run Macaron (analyze semver 7.7.2) |
| 129 | + uses: ./ |
| 130 | + with: |
| 131 | + package_url: pkg:npm/semver@7.7.2 |
| 132 | + output_dir: macaron_output/provenance |
| 133 | + |
| 134 | + - name: Run Macaron (verify provenance - semver) |
| 135 | + uses: ./ |
| 136 | + with: |
| 137 | + policy_file: ./tests/tutorial_resources/provenance/has-verified-provenance_semver.dl |
| 138 | + output_dir: macaron_output/provenance |
| 139 | + |
| 140 | + - name: Run Macaron (analyze toga 0.5.1 - PyPI provenance) |
| 141 | + uses: ./ |
| 142 | + with: |
| 143 | + package_url: pkg:pypi/toga@0.5.1 |
| 144 | + output_dir: macaron_output/provenance |
| 145 | + |
| 146 | + - name: Run Macaron (verify provenance - toga PyPI) |
| 147 | + uses: ./ |
| 148 | + with: |
| 149 | + policy_file: ./tests/tutorial_resources/provenance/has-verified-provenance_toga.dl |
| 150 | + output_dir: macaron_output/provenance |
| 151 | + |
| 152 | + - name: Run Macaron (analyze toga 0.4.8 - GitHub attestation) |
| 153 | + uses: ./ |
| 154 | + with: |
| 155 | + package_url: pkg:pypi/toga@0.4.8 |
| 156 | + output_dir: macaron_output/provenance |
| 157 | + |
| 158 | + - name: Run Macaron (verify provenance - toga GitHub) |
| 159 | + uses: ./ |
| 160 | + with: |
| 161 | + policy_file: ./tests/tutorial_resources/provenance/has-verified-provenance_toga.dl |
| 162 | + output_dir: macaron_output/provenance |
| 163 | + |
| 164 | + - name: Run Macaron (analyze urllib3 2.0.0a1 - GitHub attestation) |
| 165 | + uses: ./ |
| 166 | + with: |
| 167 | + package_url: pkg:pypi/urllib3@2.0.0a1 |
| 168 | + output_dir: macaron_output/provenance |
| 169 | + |
| 170 | + - name: Run Macaron (verify provenance - urllib3) |
| 171 | + uses: ./ |
| 172 | + with: |
| 173 | + policy_file: ./tests/tutorial_resources/provenance/has-verified-provenance_urllib3.dl |
| 174 | + output_dir: macaron_output/provenance |
| 175 | + |
| 176 | + tutorial-detect-malicious-java-dep: |
| 177 | + name: Detecting Java dependencies manually uploaded to Maven Central |
| 178 | + runs-on: ubuntu-latest |
| 179 | + steps: |
| 180 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 181 | + - name: Run Macaron (analyze example-maven-app with SBOM) |
| 182 | + uses: ./ |
| 183 | + with: |
| 184 | + package_url: pkg:maven/io.github.behnazh-w.demo/example-maven-app@2.0?type=jar |
| 185 | + repo_path: https://github.com/behnazh-w/example-maven-app |
| 186 | + output_dir: macaron_output/detect_malicious_java_dep |
| 187 | + sbom_path: ./resources/detect_malicious_java_dep/example-sbom.json |
| 188 | + deps_depth: '1' |
| 189 | + |
| 190 | + - name: Run Macaron (verify policy - detect-malicious-upload) |
| 191 | + uses: ./ |
| 192 | + with: |
| 193 | + policy_file: ./tests/tutorial_resources/detect_malicious_java_dep/example-maven-app.dl |
| 194 | + output_dir: macaron_output/detect_malicious_java_dep |
| 195 | + |
| 196 | + tutorial-exclude-include-checks: |
| 197 | + name: Exclude and include checks in Macaron |
| 198 | + runs-on: ubuntu-latest |
| 199 | + steps: |
| 200 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 201 | + |
| 202 | + - name: Run Macaron (analyze micronaut-core with default checks) |
| 203 | + uses: ./ |
| 204 | + with: |
| 205 | + package_url: pkg:maven/io.micronaut/micronaut-core@4.3.10 |
| 206 | + output_dir: macaron_output/exclude_include_checks/normal |
| 207 | + |
| 208 | + - name: Run Macaron (analyze micronaut-core excluding witness check via defaults.ini) |
| 209 | + uses: ./ |
| 210 | + with: |
| 211 | + package_url: pkg:maven/io.micronaut/micronaut-core@4.3.10 |
| 212 | + defaults_path: ./tests/tutorial_resources/exclude_include_checks/defaults_exclude_witness.ini |
| 213 | + output_dir: macaron_output/exclude_include_checks/excluded |
0 commit comments