generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 30
docs: update documentation for macaron action #1259
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
Open
Demolus13
wants to merge
11
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.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c4c5a52
docs: update documentation for macaron action
Demolus13 8dc72fe
test: update path of test resource
Demolus13 c8515f8
docs: update docs on how to setup macaron
Demolus13 79a922d
docs: update docs and macaron setup script in macaron action
Demolus13 f05a411
chore: check for macaron_image_tag for latest
Demolus13 6570a82
chore: handle macaron_image_tag to get the macaron version
Demolus13 1b74e0b
chore: get tags from repository
Demolus13 49b5499
chore: get git tag from action repository
Demolus13 137d9d8
chore: set macaron output directory
Demolus13 6e25682
docs: use hash in action quick usage example
Demolus13 181bdb8
Merge branch 'main' into pgovale/github-action
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 |
|---|---|---|
|
|
@@ -184,7 +184,7 @@ jobs: | |
| 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 | ||
| sbom_path: ./tests/tutorial_resources/detect_malicious_java_dep/example-sbom.json | ||
| deps_depth: '1' | ||
|
|
||
| - name: Run Macaron (verify policy - detect-malicious-upload) | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -4,11 +4,26 @@ | |
|
|
||
|  | ||
|
|
||
| [Full Documentation](https://oracle.github.io/macaron/index.html) | [Tutorials](https://oracle.github.io/macaron/pages/tutorials/index.html) | [Videos](https://www.youtube.com/watch?v=ebo0kGKP6bw) | [Papers](#publications) | [Presentations](#presentations) | ||
| [Full Documentation](https://oracle.github.io/macaron/index.html) | [Tutorials](https://oracle.github.io/macaron/pages/tutorials/index.html) | [Videos](https://www.youtube.com/watch?v=ebo0kGKP6bw) | [Papers](#publications) | [Presentations](#presentations) | [Macaron GitHub Action](https://oracle.github.io/macaron/pages/macaron_action.html) | ||
|
|
||
|
|
||
| **Macaron** is a software supply chain security analysis tool from Oracle Labs focused on verifying the **build integrity** of artifacts and their dependencies. It helps developers, security teams, and researchers ensure that packages are built as expected and have not been tampered with. | ||
|
|
||
| Use Macaron as a GitHub Action | ||
|
|
||
| To use the Macaron GitHub Action, add the following step to your workflow: | ||
| ```yaml | ||
| - uses: oracle/[email protected] | ||
| 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 | ||
| ``` | ||
|
|
||
|
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. Add a sentence after the example like: For detailed instructions and a comprehensive list of available options, please refer to the Macaron GitHub Action documentation . |
||
| For detailed instructions and a comprehensive list of available options, please refer to the [Macaron GitHub Action documentation](https://oracle.github.io/macaron/pages/macaron_action.html). | ||
|
|
||
| ## Key Capabilities | ||
|
|
||
| Macaron supports: | ||
|
|
||
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
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
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,134 @@ | ||
| Macaron GitHub Action | ||
| ===================== | ||
|
|
||
| Overview | ||
| -------- | ||
|
|
||
| This document describes the composite GitHub Action defined in ``action.yaml`` at the repository root. The action uses the Macaron CLI to run supply-chain security analysis and policy verification from a GitHub Actions workflow. | ||
|
|
||
| Quick usage | ||
| ----------- | ||
|
|
||
| When using this action you can reference the action in your workflow. Example: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| jobs: | ||
| analyze: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Run Macaron Security Analysis | ||
| uses: oracle/[email protected] | ||
| 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 | ||
|
|
||
| Example: policy verification only | ||
| ---------------------------------- | ||
|
|
||
| To run only the policy verification step (when you already have an output | ||
| database), call the action with ``policy_file`` and set ``output_dir`` to the | ||
| directory containing ``macaron.db``: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| - name: Verify policy | ||
| uses: oracle/[email protected] | ||
| with: | ||
| policy_file: policy.dl | ||
| output_dir: macaron-output | ||
| upload_attestation: true | ||
|
|
||
| Inputs | ||
| ------ | ||
| The action exposes a number of inputs which map directly to Macaron CLI | ||
| options. Key inputs are listed below (see ``action.yaml`` for the full list): | ||
|
|
||
| .. list-table:: Action inputs | ||
| :header-rows: 1 | ||
| :widths: 20 60 20 | ||
|
|
||
| * - Input | ||
| - Description | ||
| - Default | ||
| * - ``repo_path`` | ||
| - The path or URL of the repository to analyze. | ||
| - | ||
| * - ``package_url`` | ||
| - A PURL identifying a package to analyze instead of a repository. | ||
| - | ||
| * - ``sbom_path`` | ||
| - Path to an SBOM file to analyze. | ||
| - | ||
| * - ``python_venv`` | ||
| - Path to an existing Python virtualenv (used when analyzing Python | ||
| packages). | ||
| - | ||
| * - ``defaults_path`` | ||
| - Path to a Macaron defaults configuration file. | ||
| - | ||
| * - ``policy_file`` | ||
| - Path to a Datalog policy file for policy verification. | ||
| - | ||
| * - ``policy_purl`` | ||
| - PURL for a pre-defined policy to use with verification. | ||
| - | ||
| * - ``branch`` / ``digest`` | ||
| - Checkout options when analyzing a repository (branch name or commit | ||
| digest). | ||
| - | ||
| * - ``deps_depth`` | ||
| - Dependency resolution depth (how many levels of transitive dependencies | ||
| to resolve). | ||
| - ``0`` | ||
| * - ``github_token`` | ||
| - Token used by Macaron to access GitHub (for cloning, API access, | ||
| etc.). | ||
| - ``${{ github.token }}`` | ||
| * - ``output_dir`` | ||
| - Directory where Macaron writes results (database, reports, artifacts). | ||
| - ``output`` | ||
| * - ``upload_attestation`` | ||
| - When ``true``, the action will attempt to upload a generated | ||
| verification attestation (VSA) after policy verification. | ||
| - ``false`` | ||
|
|
||
| Outputs | ||
| ------- | ||
|
|
||
| The composite action exposes the following outputs (set by the | ||
| ``run_macaron_policy_verification.sh`` script when applicable): | ||
|
|
||
| .. list-table:: Action outputs | ||
| :header-rows: 1 | ||
| :widths: 20 70 | ||
|
|
||
| * - Output | ||
| - Description | ||
| * - ``policy_report`` | ||
| - Path to the generated policy report JSON file produced by | ||
| ``macaron verify-policy``. This file contains the policy evaluation | ||
| results. | ||
| * - ``vsa_report`` | ||
| - Path to the generated VSA (Verification Summary Attestation) in | ||
| `in-toto <https://in-toto.io/>`_ JSONL format. If no VSA was produced | ||
| during verification, the action emits the string ``"VSA Not Generated."`` | ||
| instead of a path. | ||
|
|
||
| How the action works | ||
| -------------------- | ||
|
|
||
| 1. ``Setup Macaron``: downloads ``run_macaron.sh`` script to install and run macaron in the action. | ||
|
|
||
| 2. ``Run Macaron Analysis``: calls ``scripts/actions/run_macaron_analysis.sh`` | ||
| which assembles the ``macaron analyze`` command from the inputs and runs | ||
| it. Results are written into ``output_dir``. | ||
|
|
||
| 3. ``Run Macaron Policy Verification``: if a policy file or PURL is supplied, | ||
| the corresponding script runs ``macaron verify-policy`` against the | ||
| analysis database and writes ``policy_report`` and ``vsa_report`` to | ||
| ``$GITHUB_OUTPUT`` when produced. |
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use an existing policy for this example, and also enable attestation.