Fix Rust PyPI trusted publishing permission#315
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideGrant OIDC id-token write permission in the Rust wheel build workflow so PyPI trusted publishing can succeed. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/build-rust-wheels.yml" line_range="22" />
<code_context>
permissions:
contents: read
+ id-token: write
jobs:
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider scoping `id-token: write` to the specific job that requires it rather than at the workflow level.
This makes OIDC tokens available to every job. To follow least-privilege, only enable `id-token: write` in the `permissions` block of the specific jobs that actually need it, keeping the workflow-wide permissions minimal.
Suggested implementation:
```
permissions:
contents: read
jobs:
# Build wheels for Linux
```
To fully implement least-privilege, add a `permissions` block to the specific job(s) that actually require OIDC, for example:
```yaml
jobs:
some-job-that-needs-oidc:
permissions:
id-token: write
contents: read
steps:
...
```
Adjust the job name and permissions according to the actual job in this workflow that uses OIDC (e.g. for cloud auth/deploy). Other jobs should omit `id-token: write`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write |
There was a problem hiding this comment.
🚨 suggestion (security): Consider scoping id-token: write to the specific job that requires it rather than at the workflow level.
This makes OIDC tokens available to every job. To follow least-privilege, only enable id-token: write in the permissions block of the specific jobs that actually need it, keeping the workflow-wide permissions minimal.
Suggested implementation:
permissions:
contents: read
jobs:
# Build wheels for Linux
To fully implement least-privilege, add a permissions block to the specific job(s) that actually require OIDC, for example:
jobs:
some-job-that-needs-oidc:
permissions:
id-token: write
contents: read
steps:
...Adjust the job name and permissions according to the actual job in this workflow that uses OIDC (e.g. for cloud auth/deploy). Other jobs should omit id-token: write.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #315 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 569 569
=========================================
Hits 569 569
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Summary
id-token: writeto the Rust wheel release workflow permissionsWhy
The
rust-v0.3.0release built all wheels successfully, but the PyPI publish job failed during trusted publishing because the workflow did not grant OIDC token permissions.Validation
lat check: passedSummary by Sourcery
Build: