-
Notifications
You must be signed in to change notification settings - Fork 1
CI: fix and improve claude-code-review.yml #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jnasbyupgrade
merged 9 commits into
Postgres-Extensions:master
from
jnasbyupgrade:consolidate-claude-code-review
Aug 9, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ad6e722
ci: bump Actions pins, add track_progress, add claude-debug label toggle
jnasbyupgrade 325b37c
CI: fix claude-review failing at checkout on every fork PR
jnasbyupgrade f65714d
Fix checkout pattern: don't redirect origin to the fork
jnasbyupgrade 9247047
CI: register inline-comment MCP tool for claude-code-review
jnasbyupgrade e4a126d
Fold in #26: check PR author (user.login), not head repo owner
jnasbyupgrade 0bf7e55
Merge remote-tracking branch 'origin/fix-pwn-request-checkout' into c…
jnasbyupgrade 402098a
Merge remote-tracking branch 'origin/ci-workflow-improvements' into c…
jnasbyupgrade 0b49622
Merge remote-tracking branch 'upstream/fix-claude-review-mcp-and-cach…
jnasbyupgrade 92cc528
Restore persist-credentials: false on the base-ref checkout
jnasbyupgrade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Postgres-Extensions/object_reference
Length of output: 1018
🌐 Web query:
GitHub Actions reusable workflows trusted payload pull_request_target permissions secrets💡 Result:
The pull_request_target event is a powerful but sensitive trigger in GitHub Actions that grants workflows access to base repository secrets and read/write tokens [1][2][3]. When used in conjunction with reusable workflows, it creates a specific security model that must be managed carefully to avoid privilege escalation or unauthorized secret access [4][5]. Key Security Implications and Mechanisms: 1. Trusted Execution Context: Workflows triggered by pull_request_target run the workflow file from the base repository's default branch, not the potentially untrusted pull request branch [1][2]. This design choice is intended to ensure that the logic executing with elevated privileges cannot be directly tampered with by an external contributor [2]. 2. Reusable Workflow Inheritance: Reusable workflows inherit the security context (secrets and permissions) of the caller [4][5]. If a caller workflow is triggered by pull_request_target, the called reusable workflow gains the same elevated access to repository and organization secrets [4][3]. 3. Secret Exposure Risks: - If a caller uses secrets: inherit, the reusable workflow gains access to all secrets available to the caller, including environment-scoped secrets [6][4][7]. - If the reusable workflow contains steps that checkout, build, or execute code from an untrusted pull request, an attacker may be able to extract these secrets or tokens [1][2][8]. - To mitigate this, avoid checking out untrusted code unless you use an approval gate or ensure the code is never executed [1][9]. Best Practices for Security: - Use Explicit Secret Passing: Avoid secrets: inherit whenever possible. Explicitly pass only the specific secrets required by the reusable workflow to minimize exposure [4]. - Pin Reusable Workflows: Always pin reusable workflows to a specific commit SHA rather than a branch or tag to prevent supply chain attacks where the underlying workflow is compromised [4][5]. - Workflow Splitting: Use a two-stage approach. An unprivileged workflow triggered by pull_request (which does not have secret access) handles initial PR processing. A second, privileged workflow (triggered by workflow_run) is invoked only after validation and runs in a secure context [3]. - Restrict Permissions: Follow the principle of least privilege by explicitly setting permissions for the GITHUB_TOKEN in your workflow YAML, limiting it to only what is strictly necessary [1]. - Use Environment Protection: For critical deployments triggered by pull_request_target, utilize GitHub Environments with mandatory manual approval gates [5]. This ensures that even if a workflow is triggered, the sensitive actions (like deployments or secret usage) are gated by a human reviewer [5].
Citations:
Pin
actions/checkoutto a full commit SHA.Both workflows use the mutable
v7tag; the write-capableclaude-code-review.ymlworkflow should not run code from a changeable GitHub action tag. Pin both.github/workflows/claude-code-review.yml#L150and.github/workflows/claude.yml#L39to the same full commit SHA.🧰 Tools
🪛 zizmor (1.29.0)
[error] 150-150: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
📍 Affects 2 files
.github/workflows/claude-code-review.yml#L150-L150(this comment).github/workflows/claude.yml#L39-L39🤖 Prompt for AI Agents
Source: Linters/SAST tools