generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add github actions for macaron #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Demolus13
wants to merge
10
commits into
main
Choose a base branch
from
pgovale/github-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+973
−0
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
45315bf
refactor: add github action to macaron.
Demolus13 d80dc19
refactor: improve github action usage through --existing-policy.
Demolus13 688462d
refactor: add input from subject-path in attestation.
Demolus13 2859b0e
refactor: add python_venv to inputs in action.yaml and build macaron …
Demolus13 ce8d442
chore: add test workflow for github action and test resources.
Demolus13 5f341ab
chore: set go setup cache to false.
Demolus13 b4d96b5
chore: set the correct default path for exclude checks job in publish…
Demolus13 829dae4
chore: set Hash for setup actions.
Demolus13 485f9e8
chore: correct spelling of provenance
Demolus13 eeda438
chore: change to appropriate filename
Demolus13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,213 @@ | ||
| # Copyright (c) 2025 - 2025, Oracle and/or its affiliates. All rights reserved. | ||
| # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. | ||
|
|
||
| name: Test Macaron Action (tutorials) | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - action.yaml | ||
| pull_request: | ||
| paths: | ||
| - action.yaml | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| attestations: write | ||
|
|
||
| jobs: | ||
| # tutorial-commit-finder: | ||
| # name: Analyzing and comparing different versions of an artifact | ||
| # runs-on: ubuntu-latest | ||
| # steps: | ||
| # - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| # - name: Run Macaron (analyze [email protected]) | ||
| # uses: ./ | ||
| # with: | ||
| # package_url: 'pkg:pypi/[email protected]' | ||
| # output_dir: 'macaron_output/commit_finder' | ||
|
|
||
| # - name: Run Macaron (analyze [email protected]) | ||
| # uses: ./ | ||
| # with: | ||
| # package_url: 'pkg:pypi/[email protected]' | ||
| # output_dir: 'macaron_output/commit_finder' | ||
|
|
||
| # - name: Run Macaron (verify policy - has-hosted-build) | ||
| # uses: ./ | ||
| # with: | ||
| # policy_file: './tests/tutorials/commit_finder/has-hosted-build.dl' | ||
| # output_dir: 'macaron_output/commit_finder' | ||
|
|
||
| tutorial-detect-malicious-package: | ||
| name: Detecting malicious packages | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Run Macaron (analyze [email protected] without dependencies) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:pypi/[email protected] | ||
| output_dir: macaron_output/detect_malicious_package | ||
|
|
||
| - name: Run Macaron (verify policy - check-django) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/detect_malicious_package/check-django.dl | ||
| output_dir: macaron_output/detect_malicious_package | ||
|
|
||
| - name: Setup Python for analyzed venv | ||
| uses: actions/setup-python@v6 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please pin this action to the hash that we use in other parts of Macaron. This comment applies to all the actions used in this workflow, please check. |
||
| with: | ||
| python-version: 3.11.13 | ||
|
|
||
| - name: Create and populate analyzed venv | ||
| run: | | ||
| python -m venv /tmp/.django_venv | ||
| source /tmp/.django_venv/bin/activate | ||
| pip install --upgrade pip | ||
| pip install django==5.0.6 | ||
| shell: bash | ||
|
|
||
| - name: Clean previous macaron output | ||
| run: | | ||
| rm -rf macaron_output/detect_malicious_package | ||
| shell: bash | ||
|
|
||
| - name: Run Macaron (analyze [email protected] with direct dependencies) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:pypi/[email protected] | ||
| output_dir: macaron_output/detect_malicious_package | ||
| deps_depth: '1' | ||
| python_venv: /tmp/.django_venv | ||
|
|
||
| - name: Run Macaron (verify policy - check-dependencies) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/detect_malicious_package/check-dependencies.dl | ||
| output_dir: macaron_output/detect_malicious_package | ||
|
|
||
| tutorial-detect-vulnerable-actions: | ||
| name: How to detect vulnerable GitHub Actions | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - name: Run Macaron (analyze repo - apache/logging-log4j2) | ||
| uses: ./ | ||
| with: | ||
| repo_path: https://github.com/apache/logging-log4j2 | ||
| output_dir: macaron_output/detect_vulnerable_github_actions | ||
|
|
||
| - name: Run Macaron (verify policy - github_actions_vulns for repo) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/detect_vulnerable_github_actions/check_github_actions_vuln_repo.dl | ||
| output_dir: macaron_output/detect_vulnerable_github_actions | ||
|
|
||
| - name: Run Macaron (analyze purl - log4j-core example) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:maven/org.apache.logging.log4j/[email protected] | ||
| output_dir: macaron_output/detect_vulnerable_github_actions | ||
|
|
||
| - name: Run Macaron (verify policy - github_actions_vulns for purl) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/detect_vulnerable_github_actions/check_github_actions_vuln_purl.dl | ||
| output_dir: macaron_output/detect_vulnerable_github_actions | ||
|
|
||
| tutorial-provenance: | ||
| name: Provenance discovery, extraction, and verification | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Run Macaron (analyze semver 7.7.2) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:npm/[email protected] | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| - name: Run Macaron (verify provenance - semver) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/provenance/has-verified-provenance_semver.dl | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| - name: Run Macaron (analyze toga 0.5.1 - PyPI provenance) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:pypi/[email protected] | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| - name: Run Macaron (verify provenance - toga PyPI) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/provenance/has-verified-provenance_toga.dl | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| - name: Run Macaron (analyze toga 0.4.8 - GitHub attestation) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:pypi/[email protected] | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| - name: Run Macaron (verify provenance - toga GitHub) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/provenance/has-verified-provenance_toga.dl | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| - name: Run Macaron (analyze urllib3 2.0.0a1 - GitHub attestation) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:pypi/[email protected] | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| - name: Run Macaron (verify provenance - urllib3) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/provenance/has-verified-provenance_urllib3.dl | ||
| output_dir: macaron_output/provenance | ||
|
|
||
| tutorial-detect-malicious-java-dep: | ||
| name: Detecting Java dependencies manually uploaded to Maven Central | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Run Macaron (analyze example-maven-app with SBOM) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:maven/io.github.behnazh-w.demo/[email protected]?type=jar | ||
| repo_path: https://github.com/behnazh-w/example-maven-app | ||
| output_dir: macaron_output/detect_malicious_java_dep | ||
| sbom_path: ./resources/detect_malicious_java_dep/example-sbom.json | ||
| deps_depth: '1' | ||
|
|
||
| - name: Run Macaron (verify policy - detect-malicious-upload) | ||
| uses: ./ | ||
| with: | ||
| policy_file: ./tests/tutorials/detect_malicious_java_dep/example-maven-app.dl | ||
| output_dir: macaron_output/detect_malicious_java_dep | ||
|
|
||
| tutorial-exclude-include-checks: | ||
| name: Exclude and include checks in Macaron | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - name: Run Macaron (analyze micronaut-core with default checks) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:maven/io.micronaut/[email protected] | ||
| output_dir: macaron_output/exclude_include_checks/normal | ||
|
|
||
| - name: Run Macaron (analyze micronaut-core excluding witness check via defaults.ini) | ||
| uses: ./ | ||
| with: | ||
| package_url: pkg:maven/io.micronaut/[email protected] | ||
| defaults_path: ./tests/tutorials/exclude_include_checks/defaults_exclude_witness.ini | ||
| output_dir: macaron_output/exclude_include_checks/excluded | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.