fix(claude-doc-pr): close untrusted-checkout alerts #82 and #61#987
Merged
Conversation
Alert #82 (high): gate doc-review job on fork == false so the workflow skips entirely on fork PRs rather than running with limited token access. Alert #61 (high): capture headRefOid in pr-info and pin the doc-followup checkout to that SHA to close the TOCTOU race between the fork check and the actual checkout. Add git checkout -B to reattach to the named branch so Claude can push commits back without being in detached HEAD state. Generated with AI Co-Authored-By: Claude Code <ai@netwrix.com>
…ction
git checkout -B used ${{ }} expression interpolation directly in the run
block, which expands before the shell runs — shell quoting cannot protect
against it. Pass the value through BRANCH env var instead, which is the
standard GitHub Actions mitigation for this pattern.
Generated with AI
Co-Authored-By: Claude Code <ai@netwrix.com>
hilram7
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applies the same security fixes from #986 to
claude-doc-pr.yml, which has two open CodeQL high-severity alerts.doc-reviewjob, line 19): Addgithub.event.pull_request.head.repo.fork == falseto the job condition — skips the workflow cleanly on fork PRs instead of failing with a read-only token.doc-followupjob, line 175): CaptureheadRefOidinpr-infoand pin the checkout to that SHA to eliminate the TOCTOU race between the fork/trust check and the actual checkout. Addgit checkout -Bstep after checkout so Claude isn't in detached HEAD state when it needs to push commits.Test plan
doc-reviewjob is skipped (not red)@claudeon a non-fork doc PR — verifydoc-followupruns, can commit, and pushes successfullyGenerated with AI
Co-Authored-By: Claude Code ai@netwrix.com