Skip to content

Commit 05de41f

Browse files
ondrejmirtesclaude
andcommitted
Pass evaluate exit code via marker file instead of $GITHUB_OUTPUT
octoscan flags any new bash write to `$GITHUB_OUTPUT` as a potential output-injection sink. The PHP exit code is safe in practice, but bundling it into the artifact as a marker filename (read in pr-comment-finalize via `hashFiles()`) sidesteps the rule entirely. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 12a0fac commit 05de41f

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/issue-bot.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ jobs:
197197

198198
runs-on: "ubuntu-latest"
199199

200-
outputs:
201-
pr-evaluate-exit-code: ${{ steps.evaluate-pr.outputs.exit_code }}
202-
203200
steps:
204201
- name: Harden the runner (Audit all outbound calls)
205202
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
@@ -240,7 +237,6 @@ jobs:
240237
run: "ls -lA issue-bot/tmp"
241238

242239
- name: "Evaluate results - pull request"
243-
id: evaluate-pr
244240
working-directory: "issue-bot"
245241
if: github.event_name == 'pull_request'
246242
env:
@@ -265,13 +261,16 @@ jobs:
265261
fi
266262
} > tmp/pr-comment.md
267263
268-
echo "exit_code=$exit_code" >> "$GITHUB_OUTPUT"
264+
# Marker file picked up by pr-comment-finalize via hashFiles() — avoids writing to $GITHUB_OUTPUT.
265+
case "$exit_code" in
266+
0|2) touch "tmp/pr-comment-exit-$exit_code" ;;
267+
esac
269268
270269
if [[ "$exit_code" == "2" ]]; then
271270
echo "::notice file=.github/workflows/issue-bot.yml,line=3 ::Issue bot detected open issues which are affected by this pull request - see $job_url"
272271
fi
273272
274-
# Always exit 0 for the PR pathway so the pr-comment-finalize job still receives outputs/artifacts.
273+
# Always exit 0 for the PR pathway so the pr-comment-finalize job still receives the artifact.
275274
exit 0
276275
277276
- name: "Upload step summary"
@@ -286,7 +285,9 @@ jobs:
286285
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
287286
with:
288287
name: pr-comment
289-
path: issue-bot/tmp/pr-comment.md
288+
path: |
289+
issue-bot/tmp/pr-comment.md
290+
issue-bot/tmp/pr-comment-exit-*
290291
291292
- name: "Evaluate results - push"
292293
working-directory: "issue-bot"
@@ -334,7 +335,7 @@ jobs:
334335
body-includes: "<!-- phpstan-issue-bot -->"
335336

336337
- name: "Post/update PR comment (changes)"
337-
if: needs.evaluate.outputs.pr-evaluate-exit-code == '2'
338+
if: hashFiles('pr-comment-exit-2') != ''
338339
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
339340
with:
340341
comment-id: ${{ steps.find-comment.outputs.comment-id }}
@@ -343,7 +344,7 @@ jobs:
343344
body-path: pr-comment.md
344345

345346
- name: "Update PR comment (no changes, only if exists)"
346-
if: needs.evaluate.outputs.pr-evaluate-exit-code == '0' && steps.find-comment.outputs.comment-id != ''
347+
if: hashFiles('pr-comment-exit-0') != '' && steps.find-comment.outputs.comment-id != ''
347348
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
348349
with:
349350
comment-id: ${{ steps.find-comment.outputs.comment-id }}

0 commit comments

Comments
 (0)