diff --git a/.github/workflows/pr-ready-review.yml b/.github/workflows/pr-ready-review.yml index d2acde0dbe..4bfb5b4147 100644 --- a/.github/workflows/pr-ready-review.yml +++ b/.github/workflows/pr-ready-review.yml @@ -167,8 +167,14 @@ jobs: env: EXTRA_PROMPT: ${{ inputs.extra_prompt }} run: | + # prior-comments.md is PR comment text verbatim, and commenting needs no write access. + # With a fixed delimiter, a comment containing a bare `EOF` line closes the block early: + # the step dies, and whatever follows in that comment is read as further environment + # assignments for the rest of this job, which holds the review tokens. Hence a random + # delimiter, per GitHub's guidance for untrusted multiline values. + delimiter="REVIEW_PROMPT_EOF_$(openssl rand -hex 16)" { - echo 'REVIEW_PROMPT<> "$GITHUB_ENV" - name: Automatic PR Review diff --git a/.github/workflows/pr-review-commands.yml b/.github/workflows/pr-review-commands.yml index 3c04e4e5f2..d29ffe6561 100644 --- a/.github/workflows/pr-review-commands.yml +++ b/.github/workflows/pr-review-commands.yml @@ -25,16 +25,20 @@ jobs: REMAINDER_FIRST_LINE=${FIRST_LINE#"$FIRST_WORD"} REMAINDER_FIRST_LINE=${REMAINDER_FIRST_LINE# } REST=$(printf '%s' "$BODY" | tail -n +2) + # The value is the comment body, which anyone can write. A fixed delimiter lets a + # comment close the block early and have the rest of itself read as further step + # outputs, so the delimiter has to be unguessable. + delimiter="EXTRA_EOF_$(openssl rand -hex 16)" { echo "command=$COMMAND" - echo 'extra_prompt<> "$GITHUB_OUTPUT" ;; *)