ci(publish): switch cargo publishing to trusted OIDC auth#403
ci(publish): switch cargo publishing to trusted OIDC auth#403
Conversation
Replace long-lived KORA_CLI_REGISTRY_TOKEN API token with crates.io trusted publishing via GitHub Actions OIDC identity tokens. Adds id-token: write permission and removes CARGO_REGISTRY_TOKEN env vars from both publish steps. The operator must add a trusted publisher entry on crates.io for kora-lib and kora-cli pointing to this workflow before the next publish run.
📊 TypeScript Coverage ReportCoverage: 33.1% View detailed reportCoverage artifacts have been uploaded to this workflow run. |
Greptile SummaryThis PR migrates crates.io publishing authentication from a long-lived static Confidence Score: 5/5Safe to merge — the change is a straightforward, correct migration to OIDC trusted publishing with no runtime risk once the crates.io Trusted Publisher prerequisite is configured. All findings are P2 (style/best-practice). The core logic is correct: adding No files require special attention; the single changed file is straightforward. Important Files Changed
Sequence DiagramsequenceDiagram
participant GHA as GitHub Actions Runner
participant OIDC as GitHub OIDC Provider
participant Cargo as cargo publish
participant CratesIO as crates.io
GHA->>OIDC: Request OIDC token (id-token: write)
OIDC-->>GHA: Short-lived JWT (audience: crates.io)
GHA->>Cargo: cargo publish -p kora-lib --locked
Cargo->>CratesIO: Exchange OIDC JWT for session token
CratesIO-->>Cargo: Session token (verified against Trusted Publisher config)
Cargo->>CratesIO: Publish kora-lib with session token
CratesIO-->>Cargo: Publish success
GHA->>GHA: Wait 30s for crates.io indexing
GHA->>Cargo: cargo publish -p kora-cli --locked
Cargo->>CratesIO: Exchange OIDC JWT for session token
CratesIO-->>Cargo: Session token
Cargo->>CratesIO: Publish kora-cli with session token
CratesIO-->>Cargo: Publish success
Reviews (1): Last reviewed commit: "ci(publish): switch cargo publishing to ..." | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
The Greptile suggestion was applied incorrectly, inserting a duplicate top-level jobs: key. YAML last-key-wins semantics caused the id-token: write permission block to be silently discarded, leaving cargo publish with no auth mechanism. Fix: remove the duplicate jobs/publish block and add the permissions block directly under the single publish job. Also update CLAUDE.md to remove the stale KORA_CLI_REGISTRY_TOKEN secret reference.
Summary
id-token: writepermission to the publish workflow so GitHub Actions can issue OIDC identity tokensCARGO_REGISTRY_TOKENenv vars from bothcargo publishstepscargo publishautomatically exchanges the OIDC token with crates.io when no static token is presentPrerequisites (manual, before next publish run)
On crates.io, add a Trusted Publisher for both crates:
kora-libsolana-foundationkorarust-publish.ymlkora-clisolana-foundationkorarust-publish.ymlAfter a successful publish run, the
KORA_CLI_REGISTRY_TOKENsecret can be removed from repository settings.Test Plan
Publish Rust Cratesworkflow manually after crates.io is configuredKORA_CLI_REGISTRY_TOKENsecret