Repository navigation
fix(ci): use app token for release branch pushes - #30631
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
| app-id: ${{ secrets.GH_BOT_ID }} | ||
| private-key: ${{ secrets.GH_BOT_PK }} | ||
| permission-contents: write | ||
| permission-workflows: write |
There was a problem hiding this comment.
Workflow token enables command injection
When a user dispatches this workflow with shell metacharacters in release_branch_name, line 36 interpolates the input unquoted into the shell, and add-and-commit stages and pushes the resulting modifications using the workflow-write App token persisted by checkout. This allows injected commands to push arbitrary repository changes, including modified workflow files, to the selected branch.
How this was verified: The dispatch input was traced through the unquoted run command to the all-files commit and push authenticated by the generated App token.
| steps: | ||
| - name: Generate GitHub App token | ||
| id: generate_token | ||
| uses: actions/create-github-app-token@v3 |
There was a problem hiding this comment.
Privileged action uses mutable tag
actions/create-github-app-token@v3 is referenced through a mutable major-version tag while receiving the App private key and minting a token with contents- and workflows-write access. Pinning this privileged action to an audited commit prevents an upstream tag move from exposing the private key or exercising the repository permissions granted here.
How this was verified: The mutable action reference directly receives GH_BOT_PK and requests contents- and workflows-write permissions in the same step.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| - name: Checkout Repo | ||
| uses: actions/checkout@v5 | ||
| uses: actions/checkout@v4 |
There was a problem hiding this comment.
Mutable checkout handles privileged token
When the actions/checkout@v4 tag is moved or compromised, the substituted action code receives the GitHub App token with contents-write and workflows-write permissions, allowing it to alter repository or workflow content. Pinning only the token-generation action leaves this separate privileged dependency mutable.
How this was verified: The mutable checkout reference was traced to the token input carrying the App token granted contents-write and workflows-write permissions.
Context Used: CLAUDE.md (source)
Code Review ✅ ApprovedUpdates the release workflow to generate and use a scoped GitHub App token for branch pushes with contents and workflows write permissions. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
Summary
Why
The release workflow still failed after #30611 restored actions/checkout v5. In run 30432253628, the version update and local release commit succeeded, but GitHub rejected the new branch push while validating workflows and reported that Workflows scope may be required.
The Collate release-branch workflow uses checkout v4 with a GitHub App token for checkout and push. This PR adopts that proven authentication path without copying Collate-specific submodule steps.
Checkout v4 is an incident risk reduction, not the root fix or a guarantee: actions/checkout#2287 reports v4 as a mitigation, while later reports indicate the server-side timeout can also occur on v4. The scoped App token is the durable change that avoids relying on GitHub to determine whether this branch creation updates workflow files.
Deployment prerequisite
Before rerunning the release, verify that GH_BOT_ID and GH_BOT_PK are available to this repository and that the GitHub App installation grants Contents: write and Workflows: write. The action scopes the generated token to the current repository.
Test plan
Metadata
This operational release unblock has no linked product issue; the repository-standard skip-pr-checks maintainer bypass is applied. The failed release run above is the incident evidence.
Greptile Summary
This PR changes release-branch authentication:
Confidence Score: 2/5
The PR does not appear safe to merge until the shell-injection path and mutable privileged action references are addressed.
The caller-controlled release name still reaches an unquoted shell command before a privileged commit and push, while both the token-generation action and the checkout action handling write-capable credentials are selected through mutable tags.
Files Needing Attention: .github/workflows/git-create-release-branch.yml
Security Review
The newly privileged checkout step is also selected through a mutable major-version tag, leaving a separate dependency-integrity path after the token-generation action is pinned.
Important Files Changed
Sequence Diagram
Reviews (2): Last reviewed commit: "fix(ci): use release-proven checkout ver..." | Re-trigger Greptile
Context used: