Skip to content

Pin PyPI publishing workflow actions#11

Open
lamenting-hawthorn wants to merge 1 commit into
mainfrom
codex/propose-fix-for-unpinned-pypi-publish-action
Open

Pin PyPI publishing workflow actions#11
lamenting-hawthorn wants to merge 1 commit into
mainfrom
codex/propose-fix-for-unpinned-pypi-publish-action

Conversation

@lamenting-hawthorn

@lamenting-hawthorn lamenting-hawthorn commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Motivation

  • A release job granted id-token: write at workflow scope and referenced mutable action refs, creating a supply-chain risk for PyPI trusted publishing.
  • The change scopes OIDC token minting to the publishing job and removes the global OIDC permission to reduce exposure.
  • Pinning action refs to immutable commit SHAs prevents an upstream action ref being replaced or retagged and executing attacker code during a release.

Description

  • Edited .github/workflows/release.yml to remove the top-level id-token: write workflow permission and keep id-token: write only in the publish-pypi job.
  • Replaced actions/download-artifact@v4 with a pinned commit SHA actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093.
  • Replaced pypa/gh-action-pypi-publish@release/v1 with a pinned commit SHA pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b while preserving the original job inputs.

Testing

  • Ran an automated validator script (python - <<'PY' ... PY) that asserts all publish-pypi uses: refs are 40-character SHA pins and that id-token: write is scoped to the publishing job, and the validator completed successfully.
  • Confirmed the workflow file remains functional with the publish-pypi job still containing id-token: write and no global OIDC permission present.

Codex Task

Summary by CodeRabbit

  • Chores
    • Improved release workflow security by reducing permissions.
    • Pinned release and package publishing actions to specific revisions for greater reliability.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5dcdecf3-d1b0-48f1-a9b8-eba0bf667a1c

📥 Commits

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

📒 Files selected for processing (1)
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

The release workflow now grants only contents: write and uses commit-SHA-pinned actions for artifact download and PyPI publishing.

Changes

Release workflow security

Layer / File(s) Summary
Workflow permissions and action pinning
.github/workflows/release.yml
Removes id-token: write and replaces tagged action references with pinned commit SHAs in the PyPI publishing job.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

I’m a rabbit guarding the release,
With fewer tokens, more peace.
SHA pins in a tidy row,
Secure packages hop and go.
Thump, thump—publish with care!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: pinning the PyPI publishing workflow actions.
Description check ✅ Passed It includes clear motivation, implementation details, and testing, and is mostly aligned with the repository template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/propose-fix-for-unpinned-pypi-publish-action

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.

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