Repository navigation
Sign in from GitHub Actions with a trust - #41
Merged
Merged
Conversation
With EDKA_TRUST or --trust set in a GitHub Actions job that has `id-token: write`, the CLI asks the runner for an OIDC token with the API origin as its audience and exchanges it at POST /api/cli/github-actions/token for a 15-minute access token of the trust. It exchanges a new GitHub token two minutes before expiry, so a long --wait keeps working, and saves nothing. The runner's request token goes only to its own URL, over HTTPS, and never through a redirect. `edka trusts list|get|create|delete` manage trusts, and the catalog is regenerated from the backend that adds the /api/trusts routes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 58016b5. Configure here.
…enewal `ui.Clean` drops newlines, so `trusts create` and `trusts get` printed the job settings on one line. They go through `ui.CleanText` now. A renewal starts two minutes before the token expires. When it fails, the token still serves while it has more than 30 seconds left, and GitHub's refusal of an OIDC token request is an API error, so a wait retries a 5xx or 429 like any other read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trust ref pattern now takes +, as Git does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A trust's update grant refuses an empty cluster list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

In a GitHub Actions job, the CLI can now sign in with a trust instead of a stored token. Backend: edkaio/edka#854.
Change
internal/auth/actions.go: withEDKA_TRUSTor--trustset, the CLI requests an OIDC token fromACTIONS_ID_TOKEN_REQUEST_URLwith the API origin asaudience, and exchanges it atPOST /api/cli/github-actions/tokenfor a 15-minute access token. It exchanges a new GitHub token two minutes before expiry, so a long--waitkeeps working, and saves nothing. The runner's request token goes only to its own URL, over HTTPS (HTTP on loopback for a simulated runner), never through a redirect. A trust ID that is not a UUID, a job withoutid-token: write, andEDKA_TOKENtogether withEDKA_TRUSTfail before any request;edka loginrefuses whileEDKA_TRUSTis set.api.Errorcarries the trust, so a 401/403 hints at the trust in the console instead ofedka login; a refused sign-in names what Edka compares (repository, ref, environment, workflow file).edka trusts list|get|create|delete.createresolves--clustersnames to IDs, builds the grants from--appand--allow, and prints the job settings for the new trust.internal/catalog/operations.jsonregenerated from the backend branch withbin/cli-catalog.py. It adds the five/api/trustsroutes, and also the routes that landed on the backend since the last regeneration (mobile devices and step-up, notification channels, node disk and local-disk routes, Postgres collation and image move).docs/security.md, and the agent skill viamake skill.Verification
make testandmake checkpass.internal/auth/actions_test.go: the audience sent is the API origin, the exchange body names the trust and the GitHub token, a token is reused until two minutes before expiry and then exchanged with a fresh GitHub token, HTTP runner URLs off loopback are refused, a redirect does not carry the request token, a refusal shows Edka's message with the sign-in hint, and the audience matchesURL.origin(case, default ports).internal/cli/trusts_test.go:apps update --cluster sinaia --yes --waitthrough a simulated runner and exchange: one exchange when the token outlasts the command, and a fresh exchange per request when every token is about to expire, with the newest token on the last request. Plus refusal messages, theid-token: writecheck,EDKA_TOKENwithEDKA_TRUST,login, andtrusts create/delete.whoami,apps publish,apps update --wait, and refusals for another app's package,deployments list,trusts listand a job on another branch.🤖 Generated with Claude Code
Note
Medium Risk
Introduces a new authentication path (OIDC token exchange and short-lived trust tokens) with broad CLI integration; behavior is heavily tested but misconfigured trusts or grants could block or over-limit CI deploys.
Overview
Adds GitHub Actions trust sign-in so CI jobs can call Edka without storing
EDKA_TOKEN. WithEDKA_TRUSTor--trust, the CLI fetches a runner OIDC token (API origin as audience), exchanges it atPOST /api/cli/github-actions/tokenfor a 15-minute in-memory access token, and re-exchanges ~2 minutes before expiry so long--waitruns stay authenticated. Runner request tokens are sent only to the Actions URL over HTTPS (loopback HTTP for tests), with validation that blocks mixingEDKA_TOKENandEDKA_TRUSTand blocksedka loginwhen a trust is set.New
edka trustscommands (list,get,create,delete) manage workflow trusts (repo, refs/environments, workflow file, publish/update grants) and print suggested jobpermissions/envafter create.api.Client/api.Errorcarry trust context so 401/403 messages point at console trust settings instead ofedka login, with richer hints on exchange refusal.internal/catalog/operations.jsonis regenerated (trust routes plus other backend additions such as mobile, node disk, Postgres collation). Security docs and the agent skill document the trust flow and global--trustflag.Reviewed by Cursor Bugbot for commit 58016b5. Configure here.