Skip to content
DashboardWebsite

GitHub Actions Pack

URL slug: github-actions

This page explains how the GitHub Actions pack recognizes workflow and action files, splits changes into analysis units, and applies its rules. It is for engineers reviewing changes to GitHub Actions in a repository.

The pack reads a unified git diff of GitHub Actions workflows and actions. Each changed job becomes its own analysis unit. This lets an LLM review risks such as a pull_request_target workflow running pull request code, an issue title pasted into a shell script, or a third-party action pinned to a movable tag.

PatternMatches
.github/workflows/*.yml, .github/workflows/*.yamlWorkflows
*action.yml, *action.yamlAction files, at any depth

Core matches these patterns against each changed file’s path. If no pattern matches, core asks the pack’s sniff() method. It returns 0.9 when the text has top-level on: and jobs: keys, and 0.0 otherwise. This can recognize a workflow pasted into the Analyze form or a diff at a path no pack claims. A workflow pasted without a diff is read as a new file, so content routed by sniff() produces units.

parse_diff in opentremor_pack_github_actions/parser.py reads each hunk with core’s iter_hunks. Core’s iter_yaml_blocks helper gives each changed block the key path that contains it. The pack groups blocks into units:

Change undertypename
jobs.<id>jobThe job ID, such as build
jobs.<id> when the job’s line is above the hunkjob(job above the hunk)
on, permissions, env, concurrency, name, or another top-level keyworkflow(workflow-level)
Any key in an action.yml or action.yaml fileaction(action)
  • A changed job produces one unit per file. Changes to that job in multiple hunks are grouped into one unit. If the job’s line is above the hunk, the pack does not guess its ID; it creates a separate unit for that hunk.
  • Unchanged lines between two changes to the same job stay in the unit, so an unedited step between edited steps remains visible.
  • Each job unit starts with the workflow’s trigger and permissions, when those lines appear in the diff. The pack marks them as context. The same checkout may be harmless on push and critical on pull_request_target, and the job’s own lines may not show which trigger applies.
  • source_path and group_path both contain the file path. Units from one workflow therefore group together.

A hunk is a fragment. It can start in the middle of a mapping, cut a run: | script in half, or omit the jobs: key above it. A YAML parser would reject many real hunks. Core’s yaml_diff helper reads indentation, and git’s hunk heading gives the top-level key above the hunk.

The pack has one implicit ruleset in rules/github-actions-rules.md; list_rule_types() is empty. Rules that depend on information outside the diff, such as a cloud role’s trust policy or the repository’s visibility, are review prompts. They use LOW confidence and MEDIUM severity at most. Performance and reliability rules have LOW or MEDIUM severity and do not fail the merge check on their own.

RuleSeverityWhat it catches
GHA-001CRITICALA pull_request_target or workflow_run workflow runs pull request code in a job with secrets or write access
GHA-010CRITICALAn artifact from an untrusted workflow_run is used in a privileged job
GHA-002HIGHAn untrusted ${{ }} field reaches run: or github-script directly
GHA-003HIGHA third-party action or reusable workflow is not pinned to a commit SHA; MEDIUM severity for actions/*, github/*, and the organization’s own actions
GHA-004HIGHwrite-all, or no permissions block on an untrusted trigger
GHA-005HIGHA secret reaches a log or output, or secrets: inherit passes secrets to another owner’s workflow
GHA-007HIGHA self-hosted runner is used on a public repository or for fork pull requests
GHA-008HIGHA downloaded script, binary, or installer is run without a visible integrity check
GHA-009HIGHAn untrusted run can write to a cache restored by a privileged workflow
GHA-011HIGHA security gate is removed or weakened, skipped, or set to continue-on-error
GHA-006MEDIUMReview prompt: id-token: write is used to assume a cloud role
GHA-012MEDIUMpersist-credentials remains enabled before untrusted code runs
GHA-PERF-001 to -006LOW–MEDIUMNo concurrency cancellation on pull request workflows, no dependency cache, no timeout-minutes, a larger matrix, unused full history, or repeated setup
GHA-REL-001 to -003LOW–MEDIUMDeploys that can overlap, continue-on-error on a needed job, or scheduled runs without a visible failure notice

Like every pack’s built-in ruleset, these rules seed editable rows in an organization’s custom_rules. An organization can reword, disable, or replace them without changing this package. Core keeps rows an organization has not edited in step with this file (OpenTremor-core#0034).

The demo is a new pull_request_target workflow. It checks out the pull request’s head commit, echoes the pull request’s title in a run: script, and runs a script from the checked-out tree. Its analysis shows the untrusted checkout (GHA-001), script injection (GHA-002), missing permissions block (GHA-004), tag-pinned checkout action (GHA-003), and missing timeout (GHA-PERF-003).