Repository navigation
feat(sign-in): a managed target signs in where its cluster offers it - #32
Merged
Merged
Conversation
A managed target's CLI login is held back until the cluster's first 401 answers. A 401 that names resource_metadata means the cluster signs people in itself: the login is dropped and the connection signs in as an anonymous target's does. A 401 that names none takes the login as the token source, asked for at once from then on. A sign-in must be in the organization the target's profile names, read once per profile with the target listing from `credentials status --profile NAME --json`, which reads no secret.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 614288b6-4519-46d8-8d1b-65e973b22717) |
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.
A managed target now signs in with Studio's own OAuth client wherever its cluster offers sign-in, and uses the CLI's login only where the cluster offers none (spec 016).
modernrelay-og-clusterhas offered sign-in since the managed control plane turned it on for existing clusters.How it decides
The connection holds the CLI's login back until the cluster's first 401 answers, so that request carries no token.
resource_metadata: the cluster signs people in itself. The login is dropped, and the connection signs in the way an anonymous target's does. A sign-in the keychain kept is refreshed without asking, and the CLI is never asked for a token.Organization
A sign-in must be in the organization the target's CLI profile names. Studio reads it once per profile, with the target listing, from
omnigraph credentials status --profile NAME --json(owner.organization_id), which reads no secret and contacts no service. A token in another organization is refused before it is sent, and the message names both organizations. If the CLI won't describe a profile, Studio shows a notice and leaves the check to the server. A change of organization drops a held sign-in and any sign-in service already read.Tests
graph_store:sign_in::tests::a_managed_target_signs_in_where_its_cluster_offers_itsign_in::tests::a_managed_target_uses_the_clis_login_where_its_cluster_offers_no_sign_insign_in::tests::a_sign_in_to_a_managed_target_must_be_in_its_organizationAll three fail with the hold-back disabled; I checked by disabling it.
cli_tokens::tests::the_targets_are_listed_as_the_cli_describes_themis extended, andcli_tokens::tests::a_managed_profile_the_cli_cannot_describe_is_saidis new.The full local gate passes:
cargo fmt --check, the layer, design-token and brand scripts,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspace.Not covered here: managed targets on Windows, which the CLI's login keeps refused, and choosing an organization for a person in several. Both are listed under Deferred in the spec.
Note
Medium Risk
Changes authentication branching for managed targets and OAuth org validation, but behavior is spec-driven and covered by new integration tests rather than broad refactors.
Overview
Managed cluster targets no longer always connect with the CLI’s exchanged data token. The connection holds back that login until the first unauthenticated request gets a 401: if the challenge includes
resource_metadata, Studio drops the CLI credential and signs in with its own OAuth client (like an anonymous server target); if not, it activates the CLI login as the token source from then on (one tokenless probe per connection).Target listing now runs
credentials status --profile NAME --jsononce per managed profile (deduped) and storesorganizationonCliCredential::Managed. That value flows throughTokenSource::organizationinto OAuth discovery and token checks so a sign-in must match the profile’s org; mismatches are refused before the token is sent, and org changes clear a held sign-in. Profiles the CLI can’t describe still land with a notice and server-side checks only.Specs, UI tooltips, and tests cover both cluster behaviors plus organization enforcement.
Reviewed by Cursor Bugbot for commit 296959e. Bugbot is set up for automated code reviews on this repo. Configure here.