Skip to content

fix(claude-doc-pr): close untrusted-checkout alerts #82 and #61#987

Merged
hilram7 merged 2 commits into
devfrom
fix/claude-doc-pr-untrusted-checkout
May 22, 2026
Merged

fix(claude-doc-pr): close untrusted-checkout alerts #82 and #61#987
hilram7 merged 2 commits into
devfrom
fix/claude-doc-pr-untrusted-checkout

Conversation

@DanPiazza-Netwrix
Copy link
Copy Markdown
Contributor

Summary

Applies the same security fixes from #986 to claude-doc-pr.yml, which has two open CodeQL high-severity alerts.

  • Alert New KB on account exclusions #82 (doc-review job, line 19): Add github.event.pull_request.head.repo.fork == false to the job condition — skips the workflow cleanly on fork PRs instead of failing with a read-only token.
  • Alert Pg4ns/410327 #61 (doc-followup job, line 175): Capture headRefOid in pr-info and pin the checkout to that SHA to eliminate the TOCTOU race between the fork/trust check and the actual checkout. Add git checkout -B step after checkout so Claude isn't in detached HEAD state when it needs to push commits.

Test plan

  • Open a doc PR from a fork — verify doc-review job is skipped (not red)
  • Comment @claude on a non-fork doc PR — verify doc-followup runs, can commit, and pushes successfully
  • Confirm alerts New KB on account exclusions #82 and Pg4ns/410327 #61 close after merge and CodeQL rescan

Generated with AI

Co-Authored-By: Claude Code ai@netwrix.com

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>
Comment thread .github/workflows/claude-doc-pr.yml Fixed
…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 hilram7 self-requested a review May 22, 2026 17:39
Copy link
Copy Markdown
Collaborator

@hilram7 hilram7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

  • Reviewed security fixes for CodeQL alerts #82 and #61 in claude-doc-pr.yml
  • Fork guard added to doc-review job — skips cleanly on fork PRs
  • Checkout pinned to headRefOid SHA in doc-followup job — eliminates TOCTOU race
  • git checkout -b step added so Claude isn't in detached HEAD state when pushing

@hilram7 hilram7 merged commit 961e5ea into dev May 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants