fix: Harden Claude GitHub workflows#5408
Merged
Merged
Conversation
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
chtruong814
marked this pull request as ready for review
June 20, 2026 14:43
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Phlip79
approved these changes
Jun 23, 2026
ko3n1g
approved these changes
Jun 24, 2026
chtruong814
enabled auto-merge
June 25, 2026 03:04
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/28144084178 |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 25, 2026
Signed-off-by: Charlie Truong <chtruong@nvidia.com> # Conflicts: # .github/workflows/claude-complexity-label.yml # .github/workflows/claude-copy-to-main.yml # .github/workflows/claude_review.yml
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
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
This PR hardens the Claude-enabled GitHub workflows while preserving their intended maintainer-only behavior.
Changes:
secrets.PAT.gh pr editaccess.id-token: writefrom the Claude review jobs.gh pr commentaccess from Claude's allowed tools.GITHUB_TOKENto read-only.id-token: write.Why
The Claude workflows are already gated so they do not run for actors without write access to the repository. That means these workflows are not intended to be externally triggerable by arbitrary contributors.
Example workflow that does not run for truly external user:
https://github.com/NVIDIA/Megatron-LM/actions/runs/27874311676/job/82491146034?pr=5407
The hardening is still necessary because the workflows process PR content and comments as agent context after a trusted actor triggers them. If a trusted maintainer invokes Claude on a PR containing prompt-injected content, any credentials or write capabilities available to the Claude step become part of the blast radius. These changes apply least privilege to the Claude steps themselves: Claude gets only the access it needs for analysis or conflict resolution, while deterministic workflow steps perform privileged writes after validation.
Testing
github_tokenand OIDC: whengithub_tokenis supplied, the action uses the provided token instead of requesting a GitHub OIDC token for app-token exchange.No runtime workflow execution was performed locally.