Skip to content

fix(ci): restrict release test token permissions (STA-4970) - #15675

Merged
Jinwoo-H merged 1 commit into
mainfrom
sta-4970-ci-token-hygiene
Aug 21, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
sta-4970-ci-token-hygiene

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​210 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​210
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2

ELI5

Release tests were running code from the new release tag while holding the same repository-write token used to create tags and releases. This changes the default token to read-only and gives write access back only to jobs that actually publish or dispatch release work.

What Changed

  • Set the Cut Release workflow default to contents: read.
  • Keep contents: write explicitly on the cut job that commits and pushes the release tag.
  • Add a parsed workflow-policy regression test covering the complete effective permission matrix across all release-cut jobs, local Homebrew reusable calls, the macOS publisher dispatch, and post-release E2E.
  • Discover dispatched workflows from actual workflow steps, assert the exact six release-tag execution jobs, and pin fork, ref, dependency, and gate expressions.

Why

GitHub Actions jobs inherit workflow-level permissions unless a job replaces them. The previous contents: write default therefore reached four non-publishing jobs that checked out and executed release-tagged code. Defining read as the authoritative default is the smallest structural fix; existing publishing and dispatch jobs already declare their exact writes.

Linked Issue

STA-4970

Originating PR: #14934

Visual Proof

N/A - CI workflow and static policy test only; no UI or interaction change.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated

  • Candidate policy oracle: 3/3 passed.

  • origin/main baseline: 3/3 failed on inherited write permissions.

  • Candidate with inherit-write fault injection: 3/3 failed with the same permission deltas.

  • Release workflow contracts: 76 passed, 1 existing skip.

  • pnpm lint: passed.

  • pnpm typecheck: passed.

  • actionlint syntax validation, YAML parsing, and effective 20-identity permission matrix: passed.

  • No Electron run: application behavior did not enter scope.

Review

Three fresh gpt-5.6-luna Codex reviewers independently challenged reproduction, permission boundaries, and test quality. Five validated test hardening findings were fixed; the final round was clean from all three reviewers.

Agent skill upstream boundary

  • Not applicable; no skill implementation source changed.

Notes

No runtime, platform, SSH, folder-workspace, wire, Git, or provider behavior changes. The macOS publisher retains contents: write; release-cut dispatch jobs retain actions: write; no packages, OIDC, or attestation permission is currently requested.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • N/A for screenshots because there is no UI change
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Lint, typecheck, and focused release tests pass; CI will run the repository matrix

@Jinwoo-H
Jinwoo-H force-pushed the sta-4970-ci-token-hygiene branch from 3a47348 to 40ff7a8 Compare August 21, 2026 00:03
@Jinwoo-H
Jinwoo-H marked this pull request as ready for review August 21, 2026 02:02
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 150fd092-785a-4c3d-8d96-d762e93757b1

📥 Commits

Reviewing files that changed from the base of the PR and between 012e9f4 and 40ff7a8.

📒 Files selected for processing (2)
  • .github/workflows/release-cut.yml
  • config/scripts/release-cut-token-permissions.test.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The release workflow now grants contents: read at workflow scope and contents: write only to the cut job. A new Vitest suite loads local or referenced workflows, resolves effective permissions across reusable workflows, discovers release jobs, and validates permission matrices. It also checks release-tag behavior, publishing exceptions, fork and checkout boundaries, workflow wiring, macOS builds, and E2E job permissions.

Merge Risk: ⚪ Minimal · up to 40ff7

The release workflow now uses read-only contents access by default and grants write access only to publishing jobs; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 1 files. (1 skipped: 1 unsupported.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: restricting release test token permissions in CI.
Description check ✅ Passed The description covers all required sections and provides clear scope, rationale, issue linkage, testing evidence, and checklist completion.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H merged commit a057864 into main Aug 21, 2026
95 checks passed
@Jinwoo-H
Jinwoo-H deleted the sta-4970-ci-token-hygiene branch August 21, 2026 02:14
mcxinyu pushed a commit to mcxinyu/orca that referenced this pull request Aug 22, 2026
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 23, 2026
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.

1 participant