google-github-actions / google-github-actions/run-gemini-cli

Security: fixed EOF heredoc delimiter in action.yml enables step output injection

Open Beginner friendly
#526 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.1k
Forks
285
Avg merge
8h 8m
Merged PRs (30d)
1

Description

Summary

action.yml writes the Gemini CLI's LLM response to $GITHUB_OUTPUT using a fixed EOF heredoc delimiter (lines 353-359). If the LLM response contains a bare EOF line, the heredoc closes early and subsequent name=value lines become arbitrary step outputs.

This enables bash injection in any downstream consumer workflow that template-interpolates ${{ steps.gemini_run.outputs.X }} into a run: block.

Root Cause

echo "gemini_response<<EOF" >> "${GITHUB_OUTPUT}"     # fixed delimiter
echo "${RESPONSE}" >> "${GITHUB_OUTPUT}"              # attacker-influenced
echo "EOF" >> "${GITHUB_OUTPUT}"                       # fixed delimiter

Fix

Replace fixed EOF with a random per-invocation delimiter:

_DELIM="ghdelim_$(openssl rand -hex 16)"
echo "gemini_response<<${_DELIM}" >> "${GITHUB_OUTPUT}"
echo "${RESPONSE}" >> "${GITHUB_OUTPUT}"
echo "${_DELIM}" >> "${GITHUB_OUTPUT}"

This follows the canonical pattern from GitHub's official docs.

Impact

  • Present since v0.1.12 (PR #247, 2025-08-25)
  • Affects both gemini_response and gemini_errors output channels
  • Zero authentication required (public issue triggers the flow)
  • Distinct from GHSA-62f2-6rx8-v262 (TOML template fix) - same repo, different vulnerability

Related

  • GHSA-62f2-6rx8-v262 (TOML !{...} shell expansion - fixed in PR #524)
  • GHSA-wpqr-6v78-jr5g (trust-model hardening)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in action.yml at lines 353-359 and trace how the Gemini response is written to GITHUB_OUTPUT. Check both the gemini_response and gemini_errors output channels, using the GitHub multiline-string guidance as reference. Done means a response containing a bare EOF line cannot terminate either output block early.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, shell
Domain
ci-cd, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.