Update workflow to use PyPI Trusted Publisher framework - #185
Update workflow to use PyPI Trusted Publisher framework#185ajnelson-nist wants to merge 1 commit into
Conversation
Workflow updates were adapted from CDO-Utility-Local-UUID PR 9. References: * https://docs.pypi.org/trusted-publishers/ * Cyber-Domain-Ontology/CDO-Utility-Local-UUID#9 Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
|
This PR is ready for review and merge. (The longer CI steps run on affected parts of the CI workflow.) |
|
I cannot review this one; apparently I'm not assigned as reviewer. |
vulnmaster
left a comment
There was a problem hiding this comment.
Reviewed by Vulnmaster with the help of GPT 5.6 High
Thanks for moving this project toward PyPI Trusted Publishing. Replacing the long-lived API token with OIDC is a worthwhile security improvement. I see several issues that should be addressed before merge:
-
Publishing is no longer gated by CI. The previous upload occurred at the end of the CI job, after pre-commit, tests, package building, and
twine check. The new publishing workflow is independent and does not run or depend on the test suite. Please consider making the publishing job depend on successful test and package-build jobs. -
The package is built inside the OIDC-authorized job. The job installs dependencies and invokes the Python build backend while holding
id-token: write. PyPA recommends separating building from publishing so build dependencies or project build code cannot request the publishing credential. Please build and check the distributions in a non-privileged job, upload them as an artifact, and have the publishing job only download and publish that artifact. -
contents: readis not declared for checkout. Because the job-levelpermissionsblock specifies onlyid-token: write, all unspecifiedGITHUB_TOKENpermissions are set tonone. Please give the build jobcontents: read. The final publishing job should retain onlyid-token: write. -
The release trigger changed from
publishedtoreleased. Unless stable-only behavior is intentional and documented, please retaintypes: [published]to preserve the existing release behavior and handle releases published from drafts consistently.
Please also confirm that the release GitHub environment will be created with appropriate protection rules and that the PyPI Trusted Publisher is configured for this repository, publish.yml, and the release environment.
My preferred structure would be:
- test job
- package-build job that depends on tests and uploads the checked distributions
- publishing job that depends on the package-build job, has
id-token: write, downloads the distributions, and invokespypa/gh-action-pypi-publish
Workflow updates were adapted from CDO-Utility-Local-UUID PR 9.
References: