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.
Which files it claims
Section titled “Which files it claims”| Pattern | Matches |
|---|---|
.github/workflows/*.yml, .github/workflows/*.yaml | Workflows |
*action.yml, *action.yaml | Action 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.
How changes become units
Section titled “How changes become 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 under | type | name |
|---|---|---|
jobs.<id> | job | The job ID, such as build |
jobs.<id> when the job’s line is above the hunk | job | (job above the hunk) |
on, permissions, env, concurrency, name, or another top-level key | workflow | (workflow-level) |
Any key in an action.yml or action.yaml file | action | (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
pushand critical onpull_request_target, and the job’s own lines may not show which trigger applies. source_pathandgroup_pathboth contain the file path. Units from one workflow therefore group together.
Why the pack does not use a YAML parser
Section titled “Why the pack does not use a YAML parser”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.
| Rule | Severity | What it catches |
|---|---|---|
GHA-001 | CRITICAL | A pull_request_target or workflow_run workflow runs pull request code in a job with secrets or write access |
GHA-010 | CRITICAL | An artifact from an untrusted workflow_run is used in a privileged job |
GHA-002 | HIGH | An untrusted ${{ }} field reaches run: or github-script directly |
GHA-003 | HIGH | A 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-004 | HIGH | write-all, or no permissions block on an untrusted trigger |
GHA-005 | HIGH | A secret reaches a log or output, or secrets: inherit passes secrets to another owner’s workflow |
GHA-007 | HIGH | A self-hosted runner is used on a public repository or for fork pull requests |
GHA-008 | HIGH | A downloaded script, binary, or installer is run without a visible integrity check |
GHA-009 | HIGH | An untrusted run can write to a cache restored by a privileged workflow |
GHA-011 | HIGH | A security gate is removed or weakened, skipped, or set to continue-on-error |
GHA-006 | MEDIUM | Review prompt: id-token: write is used to assume a cloud role |
GHA-012 | MEDIUM | persist-credentials remains enabled before untrusted code runs |
GHA-PERF-001 to -006 | LOW–MEDIUM | No 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 -003 | LOW–MEDIUM | Deploys 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).