Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_build_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

# The Docker integration tests require Python 3.11.
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_deploy-github-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_generate-rebase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
token: ${{ secrets.REPO_ACCESS_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_base_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_semgrep_wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# change the version tag in the 'name' description
# change the 'ref' field to use the commit hash of that tag
- name: Check out Semgrep v1.113.0 repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: semgrep/semgrep.git
ref: 4729a05d24bf9cee8face447e8a6d418037d61d8 # v1.113.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
steps:

- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'

Expand All @@ -50,7 +50,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
uses: github/codeql-action/init@d1ba80a13dd99fba24a470575428917156a28b43 # v4.37.5
with:
languages: ${{ matrix.language }}
config-file: .github/codeql/codeql-config.yaml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macaron-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
Expand All @@ -35,7 +35,7 @@ jobs:
# Note: adjust the policy_purl to refer to your repository URL.
- name: Run Macaron action
id: run_macaron
uses: oracle/macaron@4ddb55e3c9ef2c77b548be55c557078c4476fd9c # v0.24.0
uses: oracle/macaron@794eec32782979f577efb5ff71d585f683a3550f # v0.25.0
with:
repo_path: ./
policy_file: check-github-actions
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-conventional-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
token: ${{ secrets.REPO_ACCESS_TOKEN }}

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'

Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
rm -f "$CHECKSUMS"

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'

Expand Down Expand Up @@ -305,7 +305,7 @@ jobs:
# steps:

# - name: Check out repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# with:
# fetch-depth: 0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecards-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

Expand All @@ -56,6 +56,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
with:
sarif_file: results.sarif
83 changes: 74 additions & 9 deletions .github/workflows/test_macaron_action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand All @@ -103,7 +103,7 @@ jobs:
upload_reports: 'false'

- name: Setup Python for analyzed venv
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.11.14

Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand All @@ -158,12 +158,15 @@ jobs:
uses: ./
with:
repo_path: https://github.com/apache/logging-log4j2
digest: 028e9fad03ae7bcbf2e49ab8d32d8cfb900f3587
output_dir: macaron_output/detect_vulnerable_github_actions
upload_reports: 'false'
write_job_summary: 'false'

- name: Run Macaron (verify policy - github_actions_vulns for repo)
id: verify_github_actions_vulns_repo_tutorial
# Log4j calls remote reusable workflows through mutable refs, so this policy fails.
continue-on-error: true
uses: ./
with:
policy_file: ./tests/tutorial_resources/detect_vulnerable_github_actions/check_github_actions_vuln_repo.dl
Expand All @@ -172,6 +175,17 @@ jobs:
reports_artifact_name: macaron-reports-vulnerable-actions-repo
write_job_summary: 'true'

- name: Assert expected policy failure for the repository example
run: |
if [ "${{ steps.verify_github_actions_vulns_repo_tutorial.outcome }}" != "failure" ]; then
echo "Expected the repository policy to reject mutable reusable-workflow refs."
exit 1
fi
jq -e '.failed_policies == [["github_actions_vulns_repo"]] and
(.component_violates_policy | length > 0)' \
macaron_output/detect_vulnerable_github_actions/policy_report.json
test ! -e macaron_output/detect_vulnerable_github_actions/vsa.intoto.jsonl

- name: Run Macaron (analyze purl - log4j-core example)
uses: ./
with:
Expand All @@ -182,6 +196,7 @@ jobs:

- name: Run Macaron (verify policy - github_actions_vulns for purl)
id: verify_github_actions_vulns_purl_tutorial
continue-on-error: true
uses: ./
with:
policy_file: ./tests/tutorial_resources/detect_vulnerable_github_actions/check_github_actions_vuln_purl.dl
Expand All @@ -190,14 +205,25 @@ jobs:
reports_artifact_name: macaron-reports-vulnerable-actions-purl
write_job_summary: 'true'

- name: Assert expected policy failure for the PURL example
run: |
if [ "${{ steps.verify_github_actions_vulns_purl_tutorial.outcome }}" != "failure" ]; then
echo "Expected the PURL policy to reject mutable reusable-workflow refs."
exit 1
fi
jq -e '.failed_policies == [["github_actions_vulns_purl"]] and
(.component_violates_policy | length > 0)' \
macaron_output/detect_vulnerable_github_actions/policy_report.json
test ! -e macaron_output/detect_vulnerable_github_actions/vsa.intoto.jsonl

tutorial-provenance:
name: Provenance discovery, extraction, and verification
runs-on: ubuntu-latest
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down Expand Up @@ -270,7 +296,7 @@ jobs:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down Expand Up @@ -304,7 +330,7 @@ jobs:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down Expand Up @@ -337,7 +363,7 @@ jobs:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down Expand Up @@ -371,14 +397,53 @@ jobs:
exit 1
fi

test-github-actions-lockfiles:
name: Recognizing workflow lockfile coverage
runs-on: ubuntu-latest
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ inputs.docker_image_artifact_name }}
path: /tmp
- name: Load test Docker image
if: ${{ inputs.docker_image_artifact_name != '' }}
run: docker load --input /tmp/macaron-test-image.tar
- name: Analyze the pinned GraalVM workflow lockfile
id: lockfile_analysis
# Other security findings may fail this real project's policy. Inspect the facts below.
continue-on-error: true
uses: ./
with:
repo_path: https://github.com/graalvm/setup-graalvm
digest: 35ad4c011e7cfc84f7370397221f82823c74ce35
policy_file: check-github-actions
policy_purl: pkg:github.com/graalvm/setup-graalvm@.*
output_dir: macaron_output/github_actions_lockfiles
upload_reports: 'true'
reports_artifact_name: macaron-workflow-lockfile-regression
write_job_summary: 'true'
- name: Assert lockfile recognition and policy results
if: ${{ always() }}
env:
ACTION_OUTCOME: ${{ steps.lockfile_analysis.outcome }}
run: |
python3 tests/tutorial_resources/detect_vulnerable_github_actions/assert_lockfile_regression.py \
macaron_output/github_actions_lockfiles "$ACTION_OUTCOME"

test-detect-potential-injection:
name: How to detect vulnerable GitHub Actions
runs-on: ubuntu-latest
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download test Docker image artifact
if: ${{ inputs.docker_image_artifact_name != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/superpowers/

# PyBuilder
target/
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ repos:
language: python
files: ^src/macaron/|^tests/
types: [text, python]
exclude: ^tests/malware_analyzer/pypi/resources/sourcecode_samples.*
pass_filenames: false
args: [--show-traceback, --config-file, pyproject.toml]

# Enable a whole bunch of useful helper hooks, too.
Expand Down
Loading
Loading