Skip to content

Split workflow to reduce the available permissions during the build step#246

Open
kevinbackhouse wants to merge 1 commit into
GitHubSecurityLab:mainfrom
kevinbackhouse:split-pypi-workflow
Open

Split workflow to reduce the available permissions during the build step#246
kevinbackhouse wants to merge 1 commit into
GitHubSecurityLab:mainfrom
kevinbackhouse:split-pypi-workflow

Conversation

@kevinbackhouse
Copy link
Copy Markdown
Collaborator

Fixes: #228

This PR makes the same changes as #243 and #245, except on the PyPI workflow.

Copilot AI review requested due to automatic review settings May 21, 2026 17:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the PyPI publishing GitHub Actions workflow by splitting the build and publish phases into separate jobs so that elevated permissions (notably OIDC id-token: write) are only available during the publish phase, aligning with the trusted publisher security model (Fixes #228).

Changes:

  • Split the workflow into a low-permission build job and a higher-permission publish job.
  • Upload built distributions as artifacts from the build job and download them in the publish job.
  • Move provenance attestation to the publish job alongside publishing.
Show a summary per file
File Description
.github/workflows/publish-to-pypi.yaml Splits build vs publish into separate jobs to minimize permissions during build, using artifacts to pass dists to the publishing job.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

path: ./dist/

- name: Attest build provenance
uses: actions/attest@v4.1.0 # immutable release
@kevinbackhouse kevinbackhouse marked this pull request as ready for review May 21, 2026 17:22
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.

Split the PyPI publishing workflow to only have the upload in the publishing job

2 participants