ci: authenticate to crates.io over OIDC - #24
Conversation
Replaces the stored CARGO_TOKEN with a trusted-publishing exchange, so the run mints a credential scoped to itself and nothing long-lived sits in repository secrets.
|
Warning Review limit reached
Next review available in: 5 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Drops the stored
CARGO_TOKENin favour of trusted publishing. Now that both crates exist on crates.io, a trusted publisher can be configured for them — which was the only thing blocking this.permissions: contents: write # to push the crates-v* tag + id-token: write # to mint a short-lived crates.io token over OIDC + - name: Authenticate to crates.io + id: auth + uses: rust-lang/crates-io-auth-action@v1 + - name: Publish crates env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}The job now exchanges its own OIDC identity for a credential valid only for that run. Nothing long-lived sits in repository secrets, so there is nothing to leak or rotate. Both registries are on the same model now —
publish.ymlalready used OIDC for PyPI.The explicit "token is empty" guard is gone with it; the auth step fails on its own if trust is not configured.
Before merging — two crates.io settings
1.
dagron-uineeds a trusted publisher. Onlydagron-corehas one configured. Trust is per crate, not per repository, sodagron-uiwill fail to publish without it. Same values on its settings page:2. After a green release, enable "Require trusted publishing for all new versions" on both crates. That makes crates.io reject API tokens outright, so a leaked token cannot publish. Worth doing in that order — if it is enabled before this merges, the next release fails, since the workflow on
masterstill sends a token.Be aware it also closes the manual
cargo publishbreak-glass path: with it on, releases can only go out through this workflow.CARGO_TOKENcan be deleted from thecrates.ioenvironment once a release has gone out over OIDC. Revoking it on crates.io too is worthwhile — it stays valid until then.Verification
actionlintcleansecrets.CARGO_TOKENreference remains anywhere in the workflowrust-lang/crates-io-auth-action@v1resolves (rust-lang's moving release branch), exportstoken, and runs on node24 — no Node 20 deprecation