Skip to content

Commit 1f02a38

Browse files
author
fg0x0
committed
fix: randomize heredoc delimiter in GITHUB_OUTPUT writes
Replace fixed 'EOF' heredoc delimiter with a random per-invocation delimiter (ghdelim_<random>) when writing gemini_response and gemini_errors to $GITHUB_OUTPUT. The fixed 'EOF' delimiter allows an LLM response containing a bare 'EOF' line to close the heredoc early. Subsequent name=value lines in the response then become arbitrary step outputs, enabling bash injection in any downstream consumer workflow that interpolates ${{ steps.gemini_run.outputs.X }} into a run: block. This follows the canonical pattern from GitHub's official docs: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#multiline-strings Fixes the vulnerability described in: - Google VRP Issue #514026965 - Related to GHSA-62f2-6rx8-v262 (TOML template fix) Present since v0.1.12 (PR #247, 2025-08-25).
1 parent 055c24c commit 1f02a38

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,24 @@ runs:
350350
351351
352352
# Set the captured response as a step output, supporting multiline
353-
echo "gemini_response<<EOF" >> "${GITHUB_OUTPUT}"
353+
_DELIM_RESP="ghdelim_$(openssl rand -hex 16)"
354+
echo "gemini_response<<${_DELIM_RESP}" >> "${GITHUB_OUTPUT}"
354355
if [[ -n "${RESPONSE}" ]]; then
355356
echo "${RESPONSE}" >> "${GITHUB_OUTPUT}"
356357
else
357358
cat "${TEMP_STDOUT}" >> "${GITHUB_OUTPUT}"
358359
fi
359-
echo "EOF" >> "${GITHUB_OUTPUT}"
360+
echo "${_DELIM_RESP}" >> "${GITHUB_OUTPUT}"
360361
361362
# Set the captured errors as a step output, supporting multiline
362-
echo "gemini_errors<<EOF" >> "${GITHUB_OUTPUT}"
363+
_DELIM_ERR="ghdelim_$(openssl rand -hex 16)"
364+
echo "gemini_errors<<${_DELIM_ERR}" >> "${GITHUB_OUTPUT}"
363365
if [[ -n "${ERROR_JSON}" ]]; then
364366
echo "${ERROR_JSON}" >> "${GITHUB_OUTPUT}"
365367
else
366368
cat "${TEMP_STDERR}" >> "${GITHUB_OUTPUT}"
367369
fi
368-
echo "EOF" >> "${GITHUB_OUTPUT}"
370+
echo "${_DELIM_ERR}" >> "${GITHUB_OUTPUT}"
369371
370372
# Generate Job Summary
371373
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then

0 commit comments

Comments
 (0)