Skip to content

fix(ci): use app token for release branch pushes - #30631

Merged
chirag-madlani merged 2 commits into
mainfrom
ayush-shah-codex/use-app-token-release-branch
Jul 29, 2026
Merged

chirag-madlani merged 2 commits into
mainfrom
ayush-shah-codex/use-app-token-release-branch

Conversation

@ayush-shah

@ayush-shah ayush-shah commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Generate a current-repository GitHub App token for release-branch creation.
  • Grant that token only Contents write and Workflows write, then persist it through checkout for the branch push.
  • Reduce the built-in GITHUB_TOKEN permission from Contents write to Contents read.
  • Restore actions/checkout v4, the last release-proven version and the version used by the working Collate release workflow.
  • Keep EndBug/add-and-commit at v10.

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

  • git diff --check
  • Parsed the workflow as YAML
  • Verified actions/create-github-app-token@v3 declares permission-contents and permission-workflows inputs
  • After merge, rerun Create Release Branch for 1.13.2 and verify that the remote branch is created and downstream release jobs start

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:

  • Generates a current-repository GitHub App token with contents-write and workflows-write permissions.
  • Supplies that token to checkout so subsequent branch creation can push workflow changes.
  • Reduces the built-in GITHUB_TOKEN permission to contents-read.
  • Changes the checkout action from v5 to v4.

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

Filename Overview
.github/workflows/git-create-release-branch.yml Adds and persists a workflow-write App token for release pushes, but the privileged checkout dependency is mutable and the two previously reported security paths remain present.

Sequence Diagram

sequenceDiagram
  participant W as Release workflow
  participant T as App token action
  participant C as Checkout action
  participant U as Version update
  participant P as Commit and push
  W->>T: App ID and private key
  T-->>W: Contents/workflows-write token
  W->>C: Checkout selected base branch with token
  C-->>U: Working tree and persisted credentials
  U->>U: Update release versions
  U->>P: Modified files
  P->>P: Create and push release branch
Loading

Reviews (2): Last reviewed commit: "fix(ci): use release-proven checkout ver..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used:

  • Context used - CLAUDE.md (source)

Copilot AI review requested due to automatic review settings July 29, 2026 08:48
@ayush-shah
ayush-shah requested review from a team, akash-jain-10, harshach and tutte as code owners July 29, 2026 08:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jul 29, 2026
@ayush-shah ayush-shah added the skip-pr-checks Bypass PR metadata validation check label Jul 29, 2026
app-id: ${{ secrets.GH_BOT_ID }}
private-key: ${{ secrets.GH_BOT_PK }}
permission-contents: write
permission-workflows: write

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 security 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!

Copilot AI review requested due to automatic review settings July 29, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chirag-madlani
chirag-madlani merged commit 2bf627f into main Jul 29, 2026
62 checks passed
@chirag-madlani
chirag-madlani deleted the ayush-shah-codex/use-app-token-release-branch branch July 29, 2026 08:59

- name: Checkout Repo
uses: actions/checkout@v5
uses: actions/checkout@v4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security 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)

@gitar-bot

gitar-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Updates the release workflow to generate and use a scoped GitHub App token for branch pushes with contents and workflows write permissions. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants