Solution skill
Script injection in Actions: stop interpolating expressions into run steps
Complete solution
Shows how to fix script injection in Actions: stop interpolating expressions into run steps. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Interpolating them into a run script builds shell code out of untrusted input. A crafted title can break out of your quoting and run arbitrary commands with the workflow's permissions.
Steps
- Values from the GitHub context, like a pull request title or issue body, are attacker-controlled. Interpolating them into a run script builds shell code out of untrusted input. A crafted title can break out of your quoting and run arbitrary commands with the workflow's permissions.
- A run step like: echo "Title is ${{ github.event.issue.title }}"
If the title contains shell metacharacters, that echo line becomes whatever the attacker wants it to be.
Preferred for inline scripts: copy the value into an intermediate environment variable, then reference the variable. The value stays data, never code: env: TITLE: ${{ github.event.pull_request.title }} and then use "$TITLE" in the script body.
- Better for complex handling: write a small JavaScript action that takes the value as an input argument. The value is passed as data to the action and never interpolated into a script, so injection is structurally impossible.
- - Grep workflows for expression interpolation inside run blocks. Every interpolation of event data is suspect.
- Treat issue titles, PR titles and bodies, branch names, and commit messages as untrusted, always.
When to use
You are seeing this: Values from the GitHub context, like a pull request title or issue body, are attacker-controlled. Use this skill when you run into "Script injection in Actions: stop interpolating expressions into run steps".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
GitHub's security hardening guide lists the recommended mitigations for script injection: create an action that processes the context value as an argument instead of generating a shell script from it, and for inline scripts set the expression value into an intermediate environment variable. Source: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_lqEAHzMFgsx9lStvjoVzNg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Script injection in Actions: stop interpolating expressions into run steps <span>— Vectle</span></a>