Skip to content

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

Merged
kevinbackhouse merged 3 commits into
GitHubSecurityLab:mainfrom
kevinbackhouse:split-pypi-workflow
Jun 1, 2026
Merged

kevinbackhouse merged 3 commits into
GitHubSecurityLab:mainfrom
kevinbackhouse:split-pypi-workflow

Conversation

@kevinbackhouse

Copy link
Copy Markdown
Contributor

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

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.

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
Comment thread .github/workflows/publish-to-pypi.yaml Resolved
JarLob
JarLob previously approved these changes Jun 1, 2026
Co-authored-by: Jaroslav Lobačevski <jarlob@github.com>
Copilot AI review requested due to automatic review settings June 1, 2026 11:50

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's findings

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

Comment on lines +65 to +67
- name: Attest build provenance
uses: actions/attest@v4.1.0 # immutable release
with:
@kevinbackhouse
kevinbackhouse merged commit 470ef89 into GitHubSecurityLab:main Jun 1, 2026
9 checks passed
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

4 participants