GitHub Actions review: event data is not shell code
Trace GitHub Actions event inputs into run blocks, review permissions and shell failures, and follow exact analysis findings to documented safeguards.
A workflow combines YAML, GitHub expressions and commands executed by a runner. A syntactically valid YAML file can still interpolate attacker-controlled text into executable code. Review where values originate, when expressions are substituted and which credentials the affected job can use. Shell quoting inside a run block does not by itself make expression substitution safe.
Move event values across a data boundary
A pull request title, branch name or issue body may be controlled by someone outside the repository. When ${{ github.event.pull_request.title }} is embedded directly in run text, its value is substituted before the shell parses the resulting script. Pass the expression through a step environment variable and reference "$TITLE" from the shell instead. This removes direct code interpolation; it does not authorize the content for eval, a generated command or an application-level query.
Read triggers and credentials together
pull_request_target executes in the base repository context and needs particularly careful treatment of untrusted pull request code. A checkout choice and a subsequent execution step can cross that trust boundary even if the dangerous expression is elsewhere. Review permissions at workflow and job scope, plus token and secret use. Do not assume that all workflows on pull requests receive the same secret access; event type, repository settings and the source of the contribution change what is available.
Identify the shell for each run block
Runner operating system, defaults.run.shell and a step shell override determine how commands are interpreted. An explicit bash shell has different startup flags from some default invocations, and Windows jobs may use PowerShell. Do not read the entire YAML document as Bash. The browser checks extracted run code while preserving original line numbers, but multiline expressions, composite actions and external scripts can require a broader manual review than the extracted lines provide.
Inspect paths, outputs and external actions
An unchecked cd can leave later commands in the wrong directory, and rm -rf with a variable can delete more than intended even on an ephemeral runner. Quoted GITHUB_OUTPUT paths preserve argument boundaries; values written to output files still need formatting appropriate to their content. A moving action tag is an external input that can change. Check the action’s declared permissions and documented behavior, and use a reviewed commit reference when an immutable dependency is required.
Review example
This sample intentionally substitutes event text directly into shell code. A safer pattern sets TITLE in env and uses printf with "$TITLE" in the run block.
name: title-review
on: pull_request
jobs:
review:
runs-on: ubuntu-latest
steps:
- run: |
echo "${{ github.event.pull_request.title }}"
Open the checkerWhat cannot be verified
The checker cannot observe repository settings, actual token scopes, runner images or the contents of referenced actions. It does not execute a workflow. Treat a line-level injection finding as evidence of a data-to-code boundary, then assess reachability and privileges using the surrounding configuration. Not every configuration topic listed here is an implemented instant check; exact rule sections identify the topics the report can link to.
Finding references
rm -rf with a variable path
Recursive/forced rm using a variable path. If the variable is empty or unset, this can delete far more than intended.
Suggested safeguard: Guard the path: use "${dir:?dir is required}" and quote the expansion, e.g. rm -rf "${dir:?}/subdir".
SC2115Piping a download into a shell
Remote content is piped straight into a shell. A compromised or partially downloaded response executes with your privileges.
Suggested safeguard: Download to a file, verify it (checksum or signature), inspect it, then execute it as a separate step.
eval with an expansion
eval is used with an expansion. Any attacker-controlled part of that string becomes executable code.
Suggested safeguard: Replace eval with an array, a case statement, or indirect expansion (${!name}) — none of which re-parse data as code.
SC2294World-writable chmod 777
chmod 777 makes the target world-writable, so any local account can modify or replace it.
Suggested safeguard: Grant the narrowest mode that works — 755 for executables, 644 for data, 700 for private state.
cd without a failure guard
cd without a failure guard. If the directory does not exist the script keeps running in the wrong working directory.
Suggested safeguard: Write cd "$dir" || exit 1 (or set -e plus a quoted path) so the script stops instead of operating on the wrong tree.
SC2164Unquoted variable expansion
Unquoted variable expansion. Values containing spaces or glob characters get word-split and globbed before the command sees them.
Suggested safeguard: Wrap the expansion in double quotes: "$var" / "${arr[@]}".
SC2086Legacy backtick substitution
Legacy backtick command substitution. It nests badly and handles backslashes differently from the modern form.
Suggested safeguard: Use $(command) instead of `command`.
SC2006Non-portable echo -e
echo -e is not portable — it is undefined in POSIX sh and behaves differently across shells and /bin/echo builds.
Suggested safeguard: Use printf '%b\n' "$value" for escape handling that behaves the same everywhere.
SC3037sudo inside a script
The script invokes sudo. It will either prompt interactively in the middle of a run or silently require passwordless sudo.
Suggested safeguard: Check privileges up front (if [[ $EUID -ne 0 ]]) and fail with a clear message, rather than escalating mid-script.
Predictable /tmp path
Fixed path under /tmp. Predictable temp paths are a symlink-attack vector on shared machines and collide between concurrent runs.
Suggested safeguard: Create the file with mktemp (or mktemp -d) and remove it in a trap.
SC2129Parsing ls output
Parsing the output of ls. Filenames containing spaces or newlines break the pipeline.
Suggested safeguard: Use a glob or find -print0 with a while IFS= read -r -d '' loop.
SC2012read without -r
read without -r mangles backslashes in the input.
Suggested safeguard: Use read -r (and IFS= read -r line when preserving leading whitespace).
SC2162Untrusted ${{ }} expression inside run
An attacker-controllable ${{ }} value is pasted into the shell script before it runs. A crafted PR title or branch name becomes shell code.
Suggested safeguard: Pass the value through env: (e.g. env: TITLE: ${{ github.event.pull_request.title }}) and use "$TITLE" in the script.