Support non terminal environments with signer's sts providers#3
Merged
Conversation
Introduce credentials.Login, the single entry point to obtain a Carabiner identity token. It probes the STS providers registered in carabiner-dev/signer (GitHub Actions, GitLab CI) for ambient IdP credentials and exchanges them at the deadrop server (HeadlessLogin). When no ambient credentials exist it falls back to the interactive browser flow (BrowserLogin, extracted from the login command), failing fast in non-terminal environments instead of waiting for a browser. Signed-off-by: Adolfo García Veytia (Puerco) <puerco@carabiner.dev>
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@carabiner.dev>
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@carabiner.dev>
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.
This pull request refactors and enhances the Carabiner authentication flow, with a focus on simplifying the login process and improving support for both CI and interactive environments. The main change is the introduction of a unified
Loginfunction that first attempts to use ambient credentials (like OIDC tokens from CI providers) and falls back to a browser-based login only when necessary. This makes the authentication process more robust, especially in automated environments, and reduces duplicated logic. The update also removes legacy GitHub Actions OIDC token retrieval code in favor of a more generic and extensible provider-based approach.Key changes include:
Authentication Flow Refactor:
Introduced a new
Loginfunction inpkg/client/credentials/login.gothat:Removed the custom GitHub Actions OIDC token retriever (
pkg/client/github/actions.go), consolidating ambient credential detection and retrieval under the new provider-based approach.Command-Line Interface Updates:
logincommand inpkg/cmd/login.goto use the newLoginfunction, removing all inline logic for browser-based authentication and simplifying the command's flow. The help text and documentation were also updated to reflect the new behavior. [1] [2]Testing Improvements:
pkg/client/credentials/login_test.go, covering ambient credential detection, error handling, and fallback scenarios.Dependency Updates:
go.modto support the new authentication providers and flows, including newer versions ofcarabiner-dev/signer,sigstore, and related libraries.