Skip to content

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

Merged
kevinbackhouse merged 2 commits into
GitHubSecurityLab:mainfrom
kevinbackhouse:split-testpypi-workflow
May 19, 2026
Merged

Split workflow to reduce the available permissions during the build step#243
kevinbackhouse merged 2 commits into
GitHubSecurityLab:mainfrom
kevinbackhouse:split-testpypi-workflow

Conversation

@kevinbackhouse
Copy link
Copy Markdown
Collaborator

Fixes: #228 (but testing it on the TestPyPI workflow first)

I don't like what @copilot did in #230. It randomly downgraded some of the actions that're used and it also deleted the attestation step. So I'm doing it manually, so that I have higher confidence that the steps were only moved, not changed.

One change that I've made here that I'm unsure about is that the order of uploading artifacts and provenance attestation is swapped. I need to do that so that the attestation is done in the second job. Hopefully it'll still work.

Copilot AI review requested due to automatic review settings May 19, 2026 13:18
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 updates the TestPyPI publishing GitHub Actions workflow to follow the “build in a low-permission job, publish in an OIDC-privileged job” pattern, reducing the blast radius of the build step.

Changes:

  • Split the workflow into separate build and publish jobs, moving OIDC + attestation permissions to the publish job.
  • Upload dist/ artifacts from the build job and download them in the publish job for publishing/attestation.
  • Update the build job’s Python version to 3.14.
Show a summary per file
File Description
.github/workflows/publish-to-testpypi.yaml Splits build vs publish into separate jobs and relocates OIDC/attestation permissions 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

Comment on lines +54 to +57
publish:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
@kevinbackhouse kevinbackhouse marked this pull request as ready for review May 19, 2026 13:45
Copilot AI review requested due to automatic review settings May 19, 2026 13:45
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.

Copilot's findings

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

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: ${{ steps.create_version_number.outputs.RELEASE_NAME }}
RELEASE_NAME: ${{ needs.build.outputs.release_name }}
run: gh release create $RELEASE_NAME dist/* --repo $GITHUB_REPO --prerelease --generate-notes
Comment on lines +69 to +72
permissions:
contents: write
id-token: write # For trusted publishing
attestations: write # For artifact attestation
@kevinbackhouse kevinbackhouse merged commit 932b840 into GitHubSecurityLab:main May 19, 2026
13 checks passed
@kevinbackhouse kevinbackhouse deleted the split-testpypi-workflow branch May 19, 2026 16:11
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

3 participants