fix(review-pr): download artifact directly in reply-to-feedback to bypass secret masking#167
Conversation
…pass secret masking GitHub Actions' secret masking silently drops job outputs whose values resemble secrets. The `comment-json` output from `resolve-context` was being suppressed with annotation 'Skip output comment-json since it may contain secret', causing `reply-to-feedback` to always hit the 'No comment data available' error branch. Changes in `reply-to-feedback` job: - Add `actions: read` permission (needed for cross-run artifact download) - Add early `Setup credentials` step (gated on trigger-run-id) so GITHUB_APP_TOKEN is available before the artifact download - Add `Download trigger context` step that downloads the artifact directly from `inputs.trigger-run-id` using download-artifact v8.0.1, bypassing the job-output secret-masking entirely - Update `Parse comment context` to check /tmp/context/comment.json first (new trigger path), then fall through to the direct event path - Remove COMMENT_JSON / CTX_PR_NUMBER / CTX_PR_HEAD_SHA from the step env block (no longer the primary path) The `resolve-context` job and its `comment-json` output are unchanged for backward compatibility. Fixes: https://github.com/docker/cagent-action/actions/runs/25337752257 Assisted-By: docker-agent
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟡 NEEDS ATTENTION
Two medium findings and one low finding in the new steps added to reply-to-feedback. The core fix (artifact download bypassing secret masking) is correct and the step ordering is right.
F1: Delete dead legacy elif COMMENT_JSON branch — env vars COMMENT_JSON, CTX_PR_NUMBER, CTX_PR_HEAD_SHA were already removed from the step env block so the condition was permanently unreachable. F2: Guard pr_number.txt read with a hard-fail so a missing file produces an actionable ::error:: instead of silently writing an empty pr-number output and causing cryptic downstream failures. F3: Add 'Verify token for cross-run artifact download' step (gated on trigger-run-id) after 'Setup credentials', matching the same guard that already exists in the resolve-context job, for consistency and early failure on OIDC/Secrets Manager misconfiguration. Assisted-By: docker-agent
|
All three review items addressed in 136d4f8: F1 — Deleted the dead F2 — Added a hard-fail guard on echo "pr-number=$(cat /tmp/context/pr_number.txt || { echo '::error::pr_number.txt missing from artifact'; exit 1; })" >> $GITHUB_OUTPUTA missing file now surfaces a clear F3 — Added a actionlint: clean ✅ |
Problem
GitHub Actions' secret masking silently drops job outputs whose values resemble secrets. The
comment-jsonoutput from theresolve-contextjob was being suppressed with the annotation:This caused the
reply-to-feedbackjob to always enter theelsebranch and fail with:Failing run: https://github.com/docker/cagent-action/actions/runs/25337752257
Fix
Instead of relying on
needs.resolve-context.outputs.comment-json(which is silently dropped), thereply-to-feedbackjob now downloads thepr-review-contextartifact directly frominputs.trigger-run-id— the same artifact that was already successfully produced by the trigger workflow.Changes in
reply-to-feedbackjobactions: readpermission — required for cross-run artifact downloadSetup credentialsstep (first step, gated ontrigger-run-id != '') — fetchesGITHUB_APP_TOKENvia OIDC before the artifact download needs itDownload trigger contextstep — downloadspr-review-contextartifact directly from the trigger run usingactions/download-artifact@v8.0.1, bypassing job-output secret masking entirelyParse comment contextstep — checks/tmp/context/comment.jsonfirst (new trigger path), then falls through to the direct event path; removesCOMMENT_JSON/CTX_PR_NUMBER/CTX_PR_HEAD_SHAfrom the step'senvblockNot changed
The
resolve-contextjob and itscomment-jsonoutput are unchanged for backward compatibility with any other callers.The standalone
reply-to-feedback.ymlworkflow is not touched — it already works correctly.Testing