Skip to content
Open
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
12 changes: 6 additions & 6 deletions .github/workflows/_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# Even though we run the build in a matrix to check against different platforms, due to a known
# limitation of reusable workflows that do not support setting strategy property from the caller
# workflow, we only generate artifacts for ubuntu-latest and Python 3.11, which can be used to
# workflow, we only generate artifacts for Ubuntu 24.04 and Python 3.11, which can be used to
# create a release. For details see:
#
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations
Expand All @@ -32,7 +32,7 @@ on:
permissions:
contents: read
env:
ARTIFACT_OS: ubuntu-latest # The default OS for release.
ARTIFACT_OS: ubuntu-24.04 # The default OS for release.
ARTIFACT_PYTHON: '3.11' # The default Python version for release.
PACKAGE_PATH: src/macaron # The relative Python package path to the repo.

Expand All @@ -45,9 +45,9 @@ jobs:
strategy:
fail-fast: false
matrix:
# It is recommended to pin a Runner version specifically:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
os: [ubuntu-latest]
# Souffle 2.5 provides Ubuntu 22.04/24.04 packages, but none for 26.04.
# Pin the supported runner instead of following ubuntu-latest migrations.
os: [ubuntu-24.04]
python: ['3.11']
steps:

Expand Down Expand Up @@ -155,4 +155,4 @@ jobs:
artifact-sha256: ${{ needs.build.outputs.artifacts-sha256 }}
# TODO: use ${{ env.ARTIFACT_OS }} and ${{ env.ARTIFACT_PYTHON }}
# when this issue is addressed: https://github.com/actions/runner/issues/2394.
artifact-name: artifact-ubuntu-latest-python-3.11
artifact-name: artifact-ubuntu-24.04-python-3.11
2 changes: 1 addition & 1 deletion .github/workflows/_build_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:

jobs:
build-docker:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
packages: read
steps:
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 @@ -26,7 +26,7 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:

- name: Check out repository
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 @@ -33,7 +33,7 @@ permissions:

jobs:
rebase:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 35
steps:

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 @@ -13,7 +13,7 @@ permissions:
jobs:
build-base-image:
name: Build base image
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
packages: write # To push the base Docker image.
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ permissions:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependabot-automerge.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 - 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2022 - 2026, 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/.

# Automatically merge Dependabot PRs upon approval by leaving
Expand All @@ -15,7 +15,7 @@ permissions:
jobs:
comment:
if: ${{ github.event.review.state == 'approved' && github.event.pull_request.user.login == 'dependabot[bot]' }}
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Merge Dependabot PR
run: gh pr comment --body "@dependabot squash and merge" "$PR_URL"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macaron-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:

jobs:
run_macaron:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/manual-deploy-github-pages.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2025 - 2025, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2025 - 2026, 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/.

# Builds and deploys documentation to GitHub Pages on demand.
Expand All @@ -11,7 +11,7 @@ on: workflow_dispatch
permissions:
contents: read
env:
ARTIFACT_NAME: artifact-ubuntu-latest-python-3.11
ARTIFACT_NAME: artifact-ubuntu-24.04-python-3.11

jobs:
# Build the artifact.
Expand All @@ -31,5 +31,5 @@ jobs:
pages: write
id-token: write
with:
artifact-name: artifact-ubuntu-latest-python-3.11
artifact-name: artifact-ubuntu-24.04-python-3.11
artifact-sha256: ${{ needs.build.outputs.artifacts-sha256 }}
2 changes: 1 addition & 1 deletion .github/workflows/pr-conventional-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:

jobs:
conventional-commits:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:

- name: Check out repository
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
permissions:
contents: read
env:
ARTIFACT_NAME: artifact-ubuntu-latest-python-3.11
ARTIFACT_NAME: artifact-ubuntu-24.04-python-3.11
# This is the username and email for the user who commits and pushes the release
# commit. In an organisation that should be a dedicated devops account.
USER_NAME: behnazh-w
Expand All @@ -33,7 +33,7 @@ jobs:
bump:
needs: check
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
release-url: ${{ steps.release-info.outputs.release-url }}
image-name: ${{ steps.push-docker.outputs.image-name }}
image-digest: ${{ steps.push-docker.outputs.image-digest }}
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: write # To publish release notes.
packages: write # To push the Docker image.
Expand Down Expand Up @@ -299,7 +299,7 @@ jobs:
# publish_provenance:
# needs: [release, provenance]
# name: Publish provenance
# runs-on: ubuntu-latest
# runs-on: ubuntu-24.04
# permissions:
# contents: write # To publish release notes.
# steps:
Expand Down Expand Up @@ -331,5 +331,5 @@ jobs:
with:
# TODO: use ${{ env.ARTIFACT_NAME }} when this issue is addressed:
# https://github.com/actions/runner/issues/2394.
artifact-name: artifact-ubuntu-latest-python-3.11
artifact-name: artifact-ubuntu-24.04-python-3.11
artifact-sha256: ${{ needs.build.outputs.artifacts-sha256 }}
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions: read-all
jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/test_macaron_action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ permissions:
jobs:
tutorial-commit-finder:
name: Analyzing and comparing different versions of an artifact
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:

tutorial-detect-malicious-package:
name: Detecting malicious packages
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:

tutorial-detect-vulnerable-actions:
name: How to detect vulnerable GitHub Actions
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:

tutorial-provenance:
name: Provenance discovery, extraction, and verification
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -291,7 +291,7 @@ jobs:

tutorial-detect-malicious-java-dep:
name: Detecting Java dependencies manually uploaded to Maven Central
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -325,7 +325,7 @@ jobs:

tutorial-exclude-include-checks:
name: Exclude and include checks in Macaron
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -358,7 +358,7 @@ jobs:

test-detect-vulnerable-actions:
name: How to detect vulnerable GitHub Actions
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -399,7 +399,7 @@ jobs:

test-github-actions-lockfiles:
name: Recognizing workflow lockfile coverage
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down Expand Up @@ -438,7 +438,7 @@ jobs:

test-detect-potential-injection:
name: How to detect vulnerable GitHub Actions
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MACARON_IMAGE_TAG: ${{ inputs.macaron_image_tag }}
DOCKER_PULL: never
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,13 @@ requirements.txt: pyproject.toml
# found an issue. If an advisory needs to be ignored, use the --ignore-vuln option.
#
# Semgrep 1.185.0 pins mcp to 1.29.0 and restricts opentelemetry-api to 1.37.x.
# The four MCP advisories below affect MCP server/client functionality. Macaron
# invokes `semgrep scan` and does not use that functionality. OpenTelemetry
# GHSA-xcq7-p3pf-p88h affects tracestate parsing; GHSA-mf5v-w3w3-f6cg affects
# traceparent parsing. Semgrep's scan telemetry constructs only traceparent from
# process environment variables, not scanned files or untrusted request metadata.
# The five MCP advisories below affect MCP server/client functionality. Macaron
# invokes `semgrep scan` and does not use that functionality. In particular,
# GHSA-qx49-fqc8-xw99 affects OAuth-enabled MCP HTTP clients, which Macaron does not use.
# OpenTelemetry GHSA-xcq7-p3pf-p88h affects tracestate parsing;
# GHSA-mf5v-w3w3-f6cg affects traceparent parsing. Semgrep's scan telemetry
# constructs only traceparent from process environment variables, not scanned
# files or untrusted request metadata.
# Temporarily ignore these advisories until Semgrep allows mcp >=1.30.0 and
# opentelemetry-api >=1.45.2. Reassess these exceptions if Macaron's usage changes.

Expand All @@ -318,6 +320,7 @@ audit:
python -m pip_audit --skip-editable --desc on --fix --dry-run \
--ignore-vuln GHSA-84m7-p3x7-pcfv --ignore-vuln GHSA-5h93-6whr-6q8j \
--ignore-vuln GHSA-w4fh-qvv9-3v23 --ignore-vuln GHSA-rwrf-2pqf-9j8j \
--ignore-vuln GHSA-qx49-fqc8-xw99 \
--ignore-vuln GHSA-xcq7-p3pf-p88h --ignore-vuln GHSA-mf5v-w3w3-f6cg

# Run some or all checks over the package code base.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ does not remove an unpinned finding. Missing lockfiles preserve inline SHA check
invalid or unsupported present lockfiles produce actionable findings. Regenerate
and review the lockfile when dependencies change.

If Macaron cannot parse or analyze a workflow, it reports
``workflow-analysis-incomplete`` with the affected workflow and available error
details. For schema validation failures, the message identifies the rejected
field or value and its location. Fix the workflow error and rerun the analysis;
regenerating the lockfile does not resolve a workflow parsing failure.

For further reading, see GitHub's announcement:
`GitHub Actions workflow lockfiles are generally available <https://github.blog/changelog/2026-10-28-github-actions-workflow-lockfiles-are-generally-available/>`_.

Expand Down
5 changes: 4 additions & 1 deletion src/macaron/code_analyzer/dataflow_analysis/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,14 @@ class NodeForest:
root_nodes: list[Node]
#: Mapping of nodes to their parent nodes.
parents: dict[Node, Node]
#: Source files that could not be analyzed, with concise diagnostics for consumers.
analysis_errors: dict[str, str]

def __init__(self, root_nodes: list[Node]) -> None:
def __init__(self, root_nodes: list[Node], *, analysis_errors: dict[str, str] | None = None) -> None:
"""Construct a NodeForest for the given nodes, and build the parent mapping."""
self.root_nodes = root_nodes
self.parents = {}
self.analysis_errors = dict(analysis_errors) if analysis_errors is not None else {}
for root_node in root_nodes:
root_node_parents = build_parent_mapping(root_node)
self.parents.update(root_node_parents)
Expand Down
12 changes: 11 additions & 1 deletion src/macaron/parsers/actionparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import jsonschema
import yamale
from ruamel.yaml.error import MarkedYAMLError

from macaron import MACARON_PATH
from macaron.errors import ParseError
Expand Down Expand Up @@ -40,6 +41,12 @@ def parse(workflow_path: str) -> Workflow:
parse_result = yamale.make_data(workflow_path, parser="ruamel") # type: ignore[no-untyped-call]
except OSError as error:
raise ParseError("Cannot parse GitHub Workflow: " + workflow_path) from error
except MarkedYAMLError as error:
location = ""
if error.problem_mark is not None:
location = f" at line {error.problem_mark.line + 1}, column {error.problem_mark.column + 1}"
problem = error.problem or error.context or "Invalid YAML syntax"
raise ParseError(f"Cannot parse GitHub workflow {workflow_path}: invalid YAML{location}: {problem}") from error

if len(parse_result) != 1:
raise ParseError("Cannot parse GitHub Workflow: " + workflow_path)
Expand All @@ -52,7 +59,10 @@ def parse(workflow_path: str) -> Workflow:
try:
jsonschema.validate(parse_result[0][0], schema)
except jsonschema.ValidationError as e:
raise ParseError("Cannot parse GitHub Workflow, schema validation failed: " + workflow_path) from e
raise ParseError(
f"Cannot parse GitHub workflow {workflow_path}: schema validation failed at {e.json_path}: {e.message}. "
"Check the workflow syntax: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax"
) from e

return cast(Workflow, parse_result[0][0])

Expand Down
Loading
Loading