Skip to content

fix: harden release workflow permissions#12

Open
lamenting-hawthorn wants to merge 1 commit into
mainfrom
codex/fix-release-workflow-write-token-exposure
Open

fix: harden release workflow permissions#12
lamenting-hawthorn wants to merge 1 commit into
mainfrom
codex/fix-release-workflow-write-token-exposure

Conversation

@lamenting-hawthorn

Copy link
Copy Markdown
Owner

Motivation

  • Prevent exposure of a write-scoped GITHUB_TOKEN and OIDC token to build/test steps that install and run project-controlled code.
  • Reduce the attack surface for compromised dependencies or malicious build/test hooks by running mutable code with minimal repository privileges.

Description

  • Change default workflow permissions from contents: write/id-token: write to contents: read at the top level in .github/workflows/release.yml.
  • Scope the build job to contents: read and disable persisted checkout credentials with persist-credentials: false on actions/checkout@v4 so build/test steps cannot use a write-capable token.
  • Split release creation into a new release job that needs: build, downloads artifacts, and runs with contents: write only for the release step.
  • Update publish-pypi to depend on release and retain id-token: write scoped to the publishing job while keeping contents: read there.

Testing

  • Ran a text-based validation script that checks for the presence of the hardened snippets in .github/workflows/release.yml, and it succeeded.
  • Ran the test suite with python -m pytest tests/ -q, and all tests passed.
  • Attempted a YAML parse/assert check using PyYAML which failed because PyYAML is not installed in the environment, so that specific validation could not run.

Codex Task

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@lamenting-hawthorn, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 002eef86-3429-4d2e-acd9-a4145a9cde5f

📥 Commits

Reviewing files that changed from the base of the PR and between 2af24b9 and c2903b9.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-release-workflow-write-token-exposure

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

gh release create "${GITHUB_REF_NAME}" \

P1 Badge Provide a repository context to gh release create

In the new release job this command now runs after only downloading artifacts, without a checkout, so it is outside any local git repository. The GitHub CLI docs say GH_REPO is needed for commands that otherwise operate on a local repository, and gh release create alternatively accepts -R/--repo; GITHUB_REPOSITORY alone is not the CLI's repo selector. On every tagged release this step can fail before creating the GitHub Release, and publish-pypi is now blocked behind this job, so set GH_REPO: ${{ github.repository }}, pass --repo "$GITHUB_REPOSITORY", or checkout in this job.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant