Repository navigation
feat(mecatui): add remote OIDC login and credential lifecycle - #847
Conversation
Accept the registered IPv4 callback URI while retaining bounded, state-gated validation and safe rejection diagnostics. Remote mecatui login needs a stable redirect URI, and operators need actionable failures without exposing callback values or credentials. Co-Authored-By: mecatl <[email protected]>
Project sanitized provider and callback-validation failures through the MCP OAuth adapter so callers can distinguish an authorization refusal from a transport failure without leaking callback values or credentials. Co-Authored-By: mecatl <[email protected]>
Extract the issuer/JWKS HTTPS restrictions into an endpoint-scoped client so private OIDC flows can share DNS-pinned dialing, explicit CA roots, and redirect refusal instead of duplicating an SSRF-sensitive transport. Co-Authored-By: mecatl <[email protected]>
Add canonical target identity, owner-only public connection metadata, and encrypted credential records keyed by the complete OIDC client configuration. This prevents credentials from being reused across incompatible targets while keeping tokens out of the registry. Co-Authored-By: mecatl <[email protected]>
Serialize enrollment per target and coordinate credential writes with registry updates, compensation, and reconciliation. Reauthentication must not strand a new token or delete a concurrently rotated credential when persistence fails. Co-Authored-By: mecatl <[email protected]>
Implement Authorization Code with PKCE, access-token validation, CAS-safe refresh-token rotation, and local-first best-effort revocation. This gives remote mecatui targets a durable credential lifecycle without trusting stale or mis-scoped bearer tokens. Co-Authored-By: mecatl <[email protected]>
Cover enrollment, refresh, logout, and persistence races at their durability boundaries so changes cannot silently orphan credentials, lose rotation, or turn local cleanup failures into successful logout. Co-Authored-By: mecatl <[email protected]>
Translate client-auth outcomes into a closed UI-facing recovery vocabulary so the TUI can request enrollment only for actionable local credential states and keep server or transport failures distinct. Co-Authored-By: mecatl <[email protected]>
…ures Render non-secret saved-target authentication state and emit a restart intent for reauthorization. This lets the UI guide recovery without handling OAuth material or embedding browser behavior. Co-Authored-By: mecatl <[email protected]>
Connect the target-bound credential lifecycle to mecatui commands and remote connection setup so users can enroll, refresh, revoke locally, and reauthorize saved targets through one supervised flow. Co-Authored-By: mecatl <[email protected]>
Exercise the extracted HTTPS client against the supported private issuer and DNS behaviors so its reuse preserves the existing OIDC transport contract. Co-Authored-By: mecatl <[email protected]>
Add fixture coverage for the remote OIDC setup so the documented Kind path proves its registered client, issuer trust, and caller-identity prerequisites. Co-Authored-By: mecatl <[email protected]>
Describe enrollment, saved-target operation, and logout behavior so operators can configure remote mecatui authentication and understand its local credential lifecycle. Co-Authored-By: mecatl <[email protected]>
Allow the fixture client to request offline access when supported so the remote-login walkthrough can exercise refresh-token behavior without making that scope mandatory for every provider. Co-Authored-By: mecatl <[email protected]>
Document the provider scopes, grants, and client configuration required for mecatui to refresh a saved remote credential rather than unexpectedly asking users to log in again. Co-Authored-By: mecatl <[email protected]>
Provide a reproducible Kind and Keycloak walkthrough that provisions the issuer, client, trust material, and target needed to validate remote mecatui login end to end. Co-Authored-By: mecatl <[email protected]>
Grant the optional offline-access role to fixture users so the quickstart can actually obtain a refresh token after the client is allowed to request it. Co-Authored-By: mecatl <[email protected]>
Ignore a malformed persisted connection while retaining valid saved targets and rejecting invalid new writes. One legacy row should not make every remote target unavailable after an upgrade. Co-Authored-By: mecatl <[email protected]>
Route the walkthrough through a service hostname rather than localhost so mecatui treats the target as remote and does not send its local workspace to a server that owns its own workspace. Co-Authored-By: mecatl <[email protected]>
Reuse the already validated scoped client and extend the operation budget so macOS cluster.local resolution stalls do not exhaust logout before discovery and revocation. Preserve the safe provider failure cause for diagnosis. Co-Authored-By: mecatl <[email protected]>
Use literal equality for the single supported fixed callback URI and remove the duplicate absent-issuer test. Parsing fields already implied by equality added no protection or coverage. Co-Authored-By: mecatl <[email protected]>
Remove the one-consumer optional storage capability and invoke atomic corrupt repair only through the encrypted file store that owns its record lock. This keeps the recovery guarantee without presenting it as a general backend port. Co-Authored-By: mecatl <[email protected]>
…reuse RefreshSource.tokenLocked already decides a refresh is due (via its own refreshAhead window) before it ever calls oauth2.TokenSource.Token(). But that call was seeded with the token's real (not-yet-expired-by-x/oauth2's own smaller reuse threshold) expiry, so TokenSource could hand back the locally-constructed placeholder token verbatim without touching the network. That placeholder never had TokenType set, so the follow-up Save() rejected it as "corrupt credential" -- a false alarm on every refresh attempt that lands in the ~20s window between mecatl's and x/oauth2's two different staleness thresholds, self-healing only once the token crossed x/oauth2's own cutoff. The stored credential was never actually touched or corrupted. Seed TokenSource with an already-past Expiry so it always performs a real refresh_token exchange once our own gate has decided one is warranted. Found via a live Kind+Keycloak fixture qualification run (shortened token lifespans) exercising sustained active use across repeated access-token expiries. Co-Authored-By: Claude Sonnet 5 <[email protected]> Co-Authored-By: mecatl <[email protected]>
Document the 15-second operation-wide remote logout provider budget, including why cluster.local DNS resolution needs it while local logout remains independent. Co-Authored-By: mecatl <[email protected]>
e2d8583 to
dd243c1
Compare
|
I did a full panel review of this one, including the security, architecture, Kubernetes, DevOps, UX, and reuse angles. I also compared the storage model with ToolHive and toolhive-core. The fundamentals are good. Local remote-OIDC credentials use a random 256-bit wrapping key in the OS keyring plus an owner-only AES-256-GCM file store. This is the right local model and matches ToolHive's encrypted provider. The intended Kubernetes topology is also correct: I don't think this is ready to merge yet, though. I found four blockers:
A few other things are worth fixing in the same pass:
On the Kubernetes question: the current local-client to remote- Verification from a clean worktree:
So... good security work and a solid local custody model, but the four blockers above should be addressed before merge. |
Fixes the four blockers plus minor findings from the panel review on the remote OIDC login PR: - ADR 0250 supersedes ADR 0235's keep-alive policy: scopedhttps now allows a small bounded connection pool instead of disabling keep-alives outright, since dialContext already re-validates every new connection against the approved address set. RefreshSource/Login now release idle connections on close/failure via a plumbed-through CloseIdleConnections. - clientauth Registry now preserves unparseable/invalid saved-connection rows verbatim (raw JSON) across Upsert/DeleteTarget/replaceTarget instead of silently dropping them when rewriting the file for an unrelated target. - go.mod/go.sum tidied (x/tools, x/mod, go-openapi/swag bumps) to fix the GOWORK=off tidy check the k8s e2e job depends on. - deploy/mecak8s-vmcp docs now request the audience the Keycloak mapper actually issues, plus real --no-browser SSH port-forward guidance. - Saved-target connect/login paths use OpenExistingRegistry/ NewExistingKeyringProvider/OpenExistingStore so a read-only connection attempt can no longer create new keyring/registry state. - RefreshSource persists a rotated refresh token before validating the new access token, so a transient JWKS outage can no longer strand a one-time refresh token. - automountServiceAccountToken: false on the Keycloak fixture deployments. - Local failures that reauthentication cannot fix (keyring/registry/ encrypted-store unavailable, unreachable issuer/CA) now route to a distinct AuthStorageUnavailable recovery reason instead of collapsing into "sign in again" and looping. Also fixes over-engineering flagged in review of the fix itself: the namespace-directory hash naming scheme was reimplemented byte-for-byte in clientauth instead of reusing credentialstore's (now exported as NamespacePhysicalName); the keyring account-name hash was duplicated between the new and existing-only constructors (factored into keyringAccountFor); and AuthCredentialCorrupt/AuthIssuerUnavailable added no new routing behaviour over AuthCredentialUnusable/AuthStorageUnavailable (dropped, merging into those two). Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Thanks for the thorough review — pushed a fix commit (16ede81) addressing all four blockers plus the minor findings:
Minor items also addressed:
I also ran a self-review of the fix pass for over-engineering before committing: the namespace-directory hash naming was reimplemented byte-for-byte in
On the Kubernetes-workload OIDC client question — agreed, tracking that separately rather than folding it into this PR. |
…login # Conflicts: # llms.txt
The prior merge commit renamed the incoming ADR 0244 (full-request accounting/manual compaction) to 0251 to resolve the number collision with this branch's own ADR 0244 (remote mecatui OIDC), but the doc-cross- reference updates and the regenerated llms.txt were only made in the working tree after the merge commit's index was already staged, so they never made it into that commit. This finishes staging them: two stale `./0244-full-request-and-manual-compaction.md` links, the unreachable/ under-linked warnings on the renamed file, and llms.txt drift. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…login # Conflicts: # cmd/mecatui/client/client.go # cmd/mecatui/main.go # llms.txt
- Saved-target reauthentication now opens only existing keyring/store state (NewExistingKeyringProvider/OpenExistingStore) instead of the creating path, so a missing keyring entry can no longer look like corruption and get silently replaced. Regression tests cover both the login path and the store's existing-only open. - vMCP walkthrough now requests --scopes explicitly (incl. offline_access) and the fixture Keycloak realm grants the offline_access scope/role so the documented command actually receives a refresh token. - The registry-unavailable connect screen no longer offers "Sign in to a new target..." (it needs the same registry that just failed to load), closing the reauth loop. - Re-merged origin/main (status-line feature, goccy-yaml migration, safe build diagnostics) and resolved the resulting conflicts in the gRPC client (bearer token source wiring) and cmd/mecatui/main.go (ui.Deps field set), renumbered the remote-login ADRs to 0252-0258 to clear the collision with main's newly added ADRs, and regenerated llms.txt. - Minor cleanup from the review: PrivateHTTPS now rejects a supplied HTTPClient instead of silently ignoring it, legacyCredentialExists reuses credentialstore.NamespacePhysicalName instead of duplicating the hash protocol, the existing-only store contract moved into the credentialstore adapter (OpenExistingEncryptedFile), unused registryFile/Registry.write removed, and the two identical ErrDiscovery branches in main.go collapsed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Thanks — pushed a fix commit (
Smaller cleanup items:
Verification from a clean worktree: |
…login # Conflicts: # llms.txt
…login # Conflicts: # cmd/mecatui/ui/update.go # llms.txt
The rename from 0251-full-request-and-manual-compaction.md to 0259-full-request-and-manual-compaction.md was staged via git mv before the header text was corrected, so the commit shipped the renamed file with its stale "ADR 0251" title while llms.txt (generated from the already-corrected working tree) said "ADR 0259" — a mismatch the docs CI job caught. Co-Authored-By: Claude Sonnet 5 <[email protected]>
JAORMX
left a comment
There was a problem hiding this comment.
Thanks for the fix pass. Most of the previous findings are now addressed, including the vMCP scopes/audience, malformed-row preservation, refresh-token ordering, bounded keep-alives, existing-only credential-store constructor, and the merge/doc regeneration.
There are still a few blockers in the integrated path:
-
Saved-target reauthentication is still wired to the creating path.
restartFromConnectIntentinjectsrunSavedRemoteLoginatcmd/mecatui/main.go:492-498, so theReauthenticateaction reachesNewKeyringProviderandOpenStorethroughcmd/mecatui/login.go:107-130. A missing key can still mint a replacement and make the old ciphertext look corrupt. The newrunExistingSavedRemoteLoginexists, but production does not call it. Note that swapping the function directly is not enough:OpenExistingRegistryleavesRegistry.locknil (internal/adapter/clientauth/store.go:693-715), while successful enrollment reachesreplaceTargetand dereferences that lock (store.go:933-939). We need a non-creating preflight followed by an intentional mutation-capable transaction, plus a regression test through the realrestartFromConnectIntentwiring. -
Logout still creates or migrates state.
cmd/mecatui/logout.go:38-49usesOpenRegistryandNewKeyringProviderbefore opening the existing store. That can create the config root/lock and migrate legacy keyring state during an idempotent destructive operation. The absent-state path should stay non-creating. -
Logout does not reuse the scoped HTTPS client across the operation.
internal/adapter/clientauth/logout.go:143-180constructs and closes one client per retained credential, even though ADR 0257 requires one operation-wide client so later discovery/revocation requests do not repeat first-dial DNS validation. -
Provider-controlled revocation URLs can reach the UI. A
client.Dofailure retains the request URL (internal/adapter/clientauth/logout.go:315-318),recordRevocationErrorstores the raw error (logout.go:189-195), andcmd/mecatui/logout.go:88-92prints it. ADR 0252 explicitly excludes provider-controlled discovery endpoint values from errors, diagnostics, and UI state. Sanitize at the provider-error boundary. -
Discovery classification is still collapsed. Both branches at
cmd/mecatui/main.go:784-792returnAuthStorageUnavailable, andcmd/mecatui/login.go:208-213maps everyErrDiscoverythe same way. Generic issuer status/format/network failures are not local storage failures, and ADR 0252 says unknown discovery/infrastructure failures remain unclassified.
The panel also found some recovery UX gaps, especially headless reauthentication hard-coding browser launch (cmd/mecatui/main.go:540-542) and private-CA settings not following a switch to a different saved target. Those should be covered while fixing the production recovery flow rather than leaving another retry loop.
So, not quite ready to approve yet. The current CI is green except for the two root race shards still running; the latest 73149fa23 docs-only commit fixed the ADR 0259 header failure but does not change the blockers above.
…login # Conflicts: # go.mod # llms.txt
MoE-verified findings from JAORMX's latest review (5 confirmed blockers, 1 confirmed UX gap, 1 refuted as working-as-designed): 1. Saved-target reauthentication now actually wires runExistingSavedRemoteLogin in production (restartFromConnectIntent was still calling the creating runSavedRemoteLogin). OpenExistingRegistry now populates a real but inert *flock.Flock in both branches so a successful reauth's write-back (Enroll -> replaceTarget) no longer nil-pointer panics; a write against a genuinely-missing root still fails cleanly instead of creating anything. 2. mecatui logout now opens the registry/keyring via the existing-only constructors instead of the creating ones, and Logout short-circuits to a clean zero-entry result when the registry root was never created (lockTarget would otherwise ENOENT on a directory that doesn't exist). 3. Logout builds ONE scoped HTTPS client for the whole operation (merged endpoints/CA across every retained connection) instead of rebuilding one per credential, matching ADR 0258's bounded-keep-alive intent. 4. Revocation errors are now sanitized before being recorded/printed: a raw *url.Error's embedded request URL (provider-controlled, from OIDC discovery) never reaches LogoutResult.RevocationError or the CLI output; only a closed, harness-authored category does. 5. clientauth.ErrDiscovery (issuer unreachable/untrusted TLS/JWKS failure) no longer gets mapped to AuthStorageUnavailable in main.go/login.go -- it now falls through to AuthFailure's deliberate "remain unclassified" case instead of steering the user toward a local-storage reset that can't fix a network problem. 6. A Reauthenticate restart now threads the process's own headless detection (ConnectRestartIntent.NoBrowser, sourced the same way as NoBanner's non-interactive-stdin check) into the login call instead of hardcoding a browser-launch attempt. Regression tests added for each: production-wiring pin (function-pointer comparison), nil-lock write-through-existing-registry, logout-of-never- created-root no-op, shared-client-single-build + no-renewed-deadline, revocation-error URL-leak, discovery-classification, and headless-restart threading. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…login # Conflicts: # llms.txt
|
Thanks — ran a MoE-style verification pass on all 5 blockers + 2 panel findings from the last review (independent fresh-context agents adversarially re-checked each claim against the current code before I touched anything), then pushed a fix commit ( Confirmed and fixed (5 blockers + 1 UX gap):
Refuted (no change): the private-CA-not-following-target-switch item — the transport CA ( CI is fully green on the latest push ( |
JAORMX
left a comment
There was a problem hiding this comment.
Thanks for the third fix pass. The production reauthentication wiring, existing-only logout open, URL sanitization, and operation-wide cleanup budget are now in place. The panel still found a few blockers in the new integrated behavior:
-
The shared logout client unions unrelated issuer CA roots.
cmd/mecatui/logout.go:62-79concatenates every retained connection's CA bundle, andauthn/oidc/scopedhttps/client.go:40-63installs that union for every approved endpoint. A CA configured only for issuer A can therefore authenticate issuer B. Since revocation POSTs carry the still-valid access/refresh token, this is a cross-issuer credential exposure if that CA and B's route/DNS are compromised. Keep one operation-wide budget/client lifecycle, but select roots per approved issuer endpoint. The security and architecture reviewers independently confirmed this. -
Existing-target reauthentication does not preserve the identity precondition across the browser flow.
cmd/mecatui/login.go:173-212preflights one saved connection, but genericEnrolltakes a fresh snapshot and replaces whatever exists when the flow finishes (internal/adapter/clientauth/enroll.go:44-87). A concurrent logout can be resurrected, or a newer enrollment can be overwritten and its credential deleted. ADR 0258 allows this recovery only while its transaction and identity preconditions hold. The commit needs an expected-connection/CAS-style reauth write-back, with tests for concurrent logout and replacement enrollment. -
Discovery is still misclassified during refresh.
cmd/mecatui/auth.go:35-40maps anyErrDiscoverytoAuthStorageUnavailable, even though ADR 0252 says unknown discovery/infrastructure errors remain unclassified. The startup and login mappings were fixed, but this third path still sends users toward local-storage remediation for an issuer/network failure. -
Recovery is not consistently browser-free as ADR 0258 requires. Interactive reauthentication may still pass
NoBrowser=falsethroughcmd/mecatui/ui/connect.go:148-150andcmd/mecatui/main.go:547-553. Also,runDisconnectedRecoverydoes not carryNoBrowserinto itsui.Depsatcmd/mecatui/main.go:461-466, so a non-interactive startup failure loses the posture entirely. The new propagation test accepts both booleans rather than pinning the browser-free recovery contract. -
The batch client ownership path regressed cleanup on partial construction. If
HTTPClientOwnedreturns(client, true, err),internal/adapter/clientauth/logout.go:179-196returns without closing the owned client's idle connections. The previous implementation handled this shape. Please restore cleanup and add the direct regression test. -
The vMCP walkthrough still names root tasks that do not exist or operate on the wrong fixture.
deploy/mecak8s-vmcp/README.md:47-50usestask mecak8s:vmcp-*, but the rootTaskfile.yml:18-24includes onlydeploy/mecak8s-kind/Taskfile.yml;task --dry mecak8s:vmcp-checkfails. The documentedmecak8s:kind-hosts-addalso installs themecatl.svc.cluster.localaliases, not the requiredmecatl-vmcp.svc.cluster.localaliases shown atREADME.md:89-94. Now that this PR claims the remote-login walkthrough is runnable, those commands need to reach the vMCP Taskfile explicitly.
Reuse/duplication found no unnecessary abstraction. Targeted tests for cmd/mecatui/..., internal/adapter/clientauth/..., and authn/oidc/... pass, and current CI is green. These are behavioral and trust-boundary gaps that the existing tests do not cover, so I cannot approve this head yet.
MoE-verified findings from JAORMX's latest review (5 confirmed, 1 fixed directly on read): 1. scopedhttps.NewClient no longer unions every approved endpoint's CA into one shared RootCAs pool -- a cross-issuer credential exposure where issuer A's CA could authenticate a connection to issuer B. It now takes a map[endpoint][]byte and performs the TLS handshake itself via DialTLSContext, verifying each connection against ONLY that endpoint's own CA pool (VerifyConnection + a per-host x509.CertPool). Existing single-issuer callers use the new NewSingleIssuerClient convenience wrapper. Regression test drives an actual forged cert (signed by endpoint A's CA) against endpoint B and confirms it's rejected -- the exact shape the old union bug would have accepted. 2. Reauthentication now closes the TOCTOU gap between its preflight (before the interactive browser OAuth exchange, which can run arbitrarily long) and Enroll's write-back: EnrollmentConfig gained ExpectedTarget (registry-level) and ExpectedCredential (credential-version-level) preconditions, checked under the same target lock the eventual write uses. A concurrent logout or a newer enrollment for the same target during that wait now surfaces as ErrTargetChanged -> a new AuthTargetChanged recovery reason, instead of being silently resurrected or clobbered. Two regression tests cover both races directly. 3. A third ErrDiscovery-to-AuthStorageUnavailable misclassification site (cmd/mecatui/auth.go's per-RPC token-refresh path) fixed the same way as the two already addressed: falls through to AuthFailure's unclassified case instead of steering toward a local-storage reset that can't fix a network problem. 4. runDisconnectedRecovery now computes its own headless posture (the same non-interactive-stdin signal used elsewhere) instead of defaulting ui.Deps.NoBrowser to false -- a non-interactive startup failure was losing the posture entirely. (The interactive-path complaint in the same finding was investigated and found to already be correct as designed.) 5. Logout's owned-client cleanup no longer leaks idle connections when the shared client builder returns a partially-constructed client alongside an error. 6. The vMCP walkthrough's task commands now resolve: added a mecak8s-vmcp: Taskfile include (the vmcp fixture's tasks collide by name with the kind fixture's, so they need their own namespace) and fixed the two places the vmcp Taskfile itself called back into the wrong namespace. README updated to match. Additional fix found during self-review: the per-issuer CA map in cmd/mecatui/logout.go now unions CA bytes instead of overwriting when two retained connections share an issuer with different CA files, and prepareExistingSavedRemoteLogin canonicalizes its target comparison defensively rather than trusting the caller. Co-Authored-By: Claude Sonnet 5 <[email protected]>
JAORMX
left a comment
There was a problem hiding this comment.
Thanks for the fourth fix pass. The vMCP task namespace now resolves to the right fixture, refresh discovery is no longer classified as a storage failure, and the partial-client cleanup is restored. The expected-state work also closes the healthy-credential logout and re-enrollment races.
There are still three blockers:
-
The logout CA pools are isolated by hostname, not endpoint authority.
authn/oidc/scopedhttps/client.go:136-145merges roots for every URL sharing a hostname, while the approved connection is keyed by host and port. Two issuers onissuer.example:8443andissuer.example:9443therefore share roots. A CA configured only for the first issuer can authenticate the second, and revocation sends live access and refresh tokens over that connection. The new regression test uses different hostnames, so it misses this case. Key roots by the same canonicalhost:portauthority used byapprovedEndpoint, and add the same-host/different-port test. -
Corrupt-credential reauthentication still drops the credential precondition.
cmd/mecatui/login.go:170-179deliberately leavesExpectedCredentialnil afterErrCorrupt. If another process repairs or re-enrolls that same identity while the OAuth flow is open,Enrolltakes a fresh healthy snapshot and overwrites the newer credential becausecheckExpectedCredentialhas no constraint (internal/adapter/clientauth/enroll.go:67-74,:112-120). The expected-state type needs to represent "was corrupt" explicitly. At commit time, require that it is still corrupt and route a healthy replacement toErrTargetChanged. The same check should reject a newly corrupt current record when the preflight expected a concrete healthy version. -
Recovery can still open a browser. ADR 0254 says the recovery overlay "never opens a browser," and ADR 0258 defines browser-free retry as the existing
login ADDRESS --no-browserflow. Instead,cmd/mecatui/ui/connect.go:148-150copiesm.deps.NoBrowser, which is false for an interactive terminal, andcmd/mecatui/main.go:553-557passes that through to login. The test atcmd/mecatui/connect_test.go:259-293accepts both values, so it preserves the mismatch instead of pinning the contract. Reauthentication from the recovery overlay should always setNoBrowser=true.
One smaller docs issue is worth fixing in this pass: the new runnable vMCP login example still uses <mecak8s-host>, <fixture-https-issuer>, and <exported-fixture-ca> at deploy/mecak8s-vmcp/README.md:122-132, even though the exact host, issuer, and generated CA path are already known in the same document. Using those concrete values would make the promised walkthrough copy-pasteable.
I verified the previous task-routing finding with task --dry: mecak8s-vmcp:vmcp-check, kind-hosts-add, and vmcp-setup now expand through the vMCP Taskfile. CI is green on 15b55ac0c. Reuse and duplication found no unnecessary abstraction, but the two transaction/trust-boundary gaps and the documented recovery mismatch still need changes before approval.
MoE-verified findings from JAORMX's latest review (3 blockers + 1 docs issue, all confirmed by independent fresh-context review agents): 1. scopedhttps's CA-pool isolation was keyed by hostname only, not the full host:port authority -- two different issuers sharing a hostname on different ports would share one merged CA pool. Now keyed by the same host:port authority approvedEndpoint already uses. New test drives a forged cert through the exact same-host/ different-port shape. 2. The reauthentication CAS precondition had a gap for corrupt credentials: ExpectedCredential was left nil after a corrupt preflight read, so a healthy repair landing during the browser wait could still be clobbered. ExpectedCredentialState gained a Corrupt field; the repair path now only proceeds if the record is STILL corrupt at commit time, and a current record that's corrupt when a healthy/absent state was expected is also rejected. New test covers the repaired-during-corrupt-signin race. 3. The recovery overlay's Reauthenticate action now always sets NoBrowser=true (ADR 0254: the overlay never opens a browser), instead of deriving it from the process's own interactive/headless posture. Since that was NoBrowser's only reader, the now-dead ui.Deps.NoBrowser field and its two setters were removed. New test pins the always-true contract against the real UI method; the existing lower-level plumbing test's stale doc comment was corrected to describe what it actually covers. 4. The vMCP login walkthrough now uses concrete, copy-pasteable values (host, issuer, exported CA path) instead of placeholders. Independent fresh-context verification of finding 3 raised a genuine disagreement worth recording: reading ADR 0254 fresh, it reached the same conclusion as an earlier review round -- "never opens a browser" more plausibly describes the overlay's own display step than a mandate covering every subsequent reauthentication -- and flagged a real UX cost (an interactive user no longer gets an automatic browser launch). Implemented anyway per the reviewer's explicit, twice-stated directive to avoid another review cycle; flagging here for visibility. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
I pulled There is one smaller invariant issue left in the browser-free fix. I would remove Other than that, this pass looks clean. I did not rerun CI locally; GitHub does not report checks for |
…login # Conflicts: # llms.txt
…login # Conflicts: # llms.txt
|
I pulled the new head ( The merge also left the OIDC ADR renumbering inconsistent. The files moved to 0270–0277, but their titles and cross-references still use the old 0253–0260 numbers. For example:
Several links still point to files that no longer exist, such as CI is still in progress on this merge head; the docs jobs have not started yet. |
… boundary Also finishes the ADR 0253-0260 -> 0270-0277 renumber (main claimed those numbers with unrelated ADRs): commits the doc-body number/cross-reference fixes that were staged as part of the rename but not yet edited when the merge commit landed. A boolean field on ConnectRestartIntent that "is always true, per ADR 0254" was still representable as false, and the plumbing test accepted both values -- so a future producer or refactor could reopen the browser path for reauthentication. Removed the field; restartFromConnectIntentWith now passes true unconditionally for the Reauthenticate branch, so the ADR 0254 contract (recovery overlay never opens a browser) can't be violated by any producer of the intent. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Thanks for the fifth pass, and sorry for the delay picking it up. Fixed the remaining invariant issue: removed Also finished committing the ADR 0253-0260 -> 0270-0277 renumber from the merge with
|
|
The behavioral fix is correct now: The ADR file bodies are mostly renumbered, but a few stale references remain:
The implementation is clean from this pass. Once those remaining references are made consistent, I have no further findings. CI is still running on |
The earlier batch renumber's blanket "[0253 --" replace also hit the unrelated line pointing at main's own ADR 0253-sdk-mocking-testkit.md, restored to its real number. Fixes README's supersedes/superseded-by number ranges (0253-0256 -> 0270-0273, "superseded by 0260" -> 0277), adds the missing ADR 0275 credential-recovery-classification supersession to 0277's header, and updates the remaining stale ADR-number code/test comments (0254->0271, 0258->0275, 0252->0277). Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Thanks -- fixed all five items:
|
JAORMX
left a comment
There was a problem hiding this comment.
ADR renumber cleanup is complete, the post-43f054101 changes are limited to that cleanup, and all current-head CI checks are green.
Addresses the 2026-09-23 review round: - Document the /oauth/callback redirect_uri registration requirement for preregistered/CIMD clients in user-docs (AGENTS.md requires this in the same PR as the behavior change). - Fix a comment in cmd/mecated/mcplogin.go that referenced opts.Client.DCR on a local oauthlogin.Options value that has no Client field; the DCR field actually lives on the unrelated mcp.OAuthOptions built in internal/cliconfig/mcpprofile.go. - Add TestRunMCPLoginProductionOptionsKeepDCRPriorityThroughRealRuntime: an app-wiring-layer test that captures the real production oauthlogin.Options, obtains a genuine registration-bound callback path from mcp.PrepareOAuthDCRLogin against a real DCR fixture, and drives both through a real oauthlogin.Runtime -- proving the priority holds beyond the isolated mcp/oauthlogin package. - Replace the port-distinctness assertion in TestPinCallbackPathUsesFixedPathEphemeralPort (flaky if the OS legally reuses a just-released ephemeral port) with an assertion on the bind address requested via the injected listener seam. - Extract assertUnauthenticatedFloodDoesNotSpendAttempts, shared by TestExactRedirectUnauthenticatedFloodDoesNotSpendAttempts and TestPinCallbackPathUnauthenticatedFloodDoesNotSpendAttempts, which had drifted into a near-duplicate. - Return a callbackMode struct from resolveCallbackMode instead of five positional string/enum values, matching the file's existing fixedRedirectConfig convention and removing a silent-reorder risk. - Extract exactRedirectAddress so "127.0.0.1:18473" has one source instead of three duplicated literals that must stay byte-identical. Two other findings from the same review round were pushed back on with reasoning posted to the PR rather than implemented: - The "CIMD cannot work with this mode" blocker: CIMD is a public/native client mechanism by design and by this codebase's own config schema (no secret field), so RFC 8252 loopback matching applies to a CIMD-declared redirect_uri the same as it does to a preregistered one. - The "needs a superseding ADR" claim: two prior PRs (#847, #1388) already added new fixed-callback Options fields to this exact runtime without a superseding ADR, establishing that this is within-mechanism extension, not an architectural decision. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Summary
Closes #790.
Remote
mecatuican now enroll and use a target-bound OIDC caller identity when connecting to a remotemecatedormecak8sserver.invalid_grantfailures for cleanup, and gives the TUI explicit recovery choices without browser-login loops;cluster.localDNS fallback and preserves secret-free failure reporting;offline_accesssupport;Verification
task docstask site:buildThe branch also adds focused offline coverage for callback validation, credential lifecycle and storage boundaries, refresh behavior, logout/revocation budgeting, and the Kind fixture configuration.