Repository navigation
feat(identitybroker): AS-2 trusts the hosted AS-1 in production - #3018
Conversation
v0.70.1 turns on subject resolution at ID-JAG redemption (stacklok/toolhive#7247), which #2533 needs. Co-authored-by: Mecatl <[email protected]>
…y IdP With mcpbroker.AS1Trust set, the embedded gateway's authorization server (AS-2) trusts AS-1's ID-JAGs in ToolHive's subject mode resolve: it finds the gateway user from the ID-JAG's upstream_subject through the company IdP, which becomes the first step of AS-2's sign-in, accepts only the agent trust domain as the actor's issuer, and issues marked gateway tokens that ToolHive refuses at token exchange. This replaces the test-only per-subject trust. Composition still sets the trust only in tests; the next change wires it from mecak8s's configuration. What only tests may set (the vMCP's maximum call duration, and a sign-in client in AS-2's store) moves to mcpbroker.TestSeam, kept out of production code by an internal package and depguard. mcpbrokertest signs users in at AS-2 so tests across packages can redeem through resolution. Part of #2533. Co-authored-by: Mecatl <[email protected]>
…s scans `go work sync` dropped the go.mod hashes the standalone modules need, so `GOWORK=off` builds failed; `task tidy:module` restores them for environment/microvm, authn/oidc and the providers. go-redis 9.24 deprecates ScanIterator.Next and Val, so the Redis stores range over Vals instead. Co-authored-by: Mecatl <[email protected]>
Co-authored-by: Mecatl <[email protected]>
Startup builds the embedded gateway authorization server's (AS-2) trust from the hosted AS-1: its issuer and signing keys, the agent trust domain, and AS-1's company IdP issuer, subject claim and CA, so AS-2 and AS-1 cannot disagree. The operator supplies only AS-2's own client at the company IdP and, for an in-cluster AS-1, a CA and private-address setting for fetching AS-1's keys (--identity-broker-as2-* flags and identityBroker.as2 Helm values). The embedded gateway entry may now list servers once AS-1 is hosted and AS-2's client is set; settings that would do nothing are refused, in mecak8s and in the chart. The trust is carried on the AS-1 the broker uses, so tests with an external AS-1 set it there and no top-level test-only trust remains. The operator guide covers AS-2's registration, the key-fetch settings and the IdP caveats. Part of #2533. Co-authored-by: Mecatl <[email protected]>
…docs Address review of #3015: - Check AS-2's trust in AS-1 and the company IdP name collision before anonymous discovery contacts any upstream. - Say that composition must fill the company IdP's issuer, claim and CA, and the actor issuer, from AS-1's settings, and what a mismatch looks like. - ToolHive always allows a loopback company IdP, and refuses a private key-set host at startup only when it is a literal address. - ToolHive refuses a future iat within its skew; the lifetime cap bounds how old an ID-JAG can be. A refusal row pins the future iat. - Pin the authorization request the company IdP receives: no prompt or max_age, PKCE, AS-2's client and callback, and today's scope. Co-authored-by: Mecatl <[email protected]>
Co-authored-by: Mecatl <[email protected]>
Co-authored-by: Mecatl <[email protected]>
|
Holding until a ToolHive release contains stacklok/toolhive#7347 (provider identities bound to their issuer and claim), per review on #3015. This PR will bump ToolHive to that release before it merges. |
jhrozek
left a comment
There was a problem hiding this comment.
Approving. The trust is built from the hosted AS-1, so AS-1 and AS-2 can't disagree on the IdP, the claim or the actor issuer. With the new settings unset nothing changes, the chart refuses the same combinations as mecak8s, and TestHostedAS1GatewayCallFromFlags covers the whole path from flags alone. One small nit inline.
origin/main's tree equals #3015's final commit, already on this branch, so every conflict resolves to this branch's side. Co-authored-by: Mecatl <[email protected]>
The ban's pattern allowed no digit after the flag prefix, so both flags for AS-2's fetch of AS-1's keys got past it. Co-authored-by: Mecatl <[email protected]>
|
No longer holding. #2533 doesn't need another ToolHive release, so the bump to a release containing stacklok/toolhive#7347 (provider identities bound to their issuer and claim) is tracked in #3019, under slice 4. Until then, the gap needs an operator to switch AS-2's company IdP or identifying claim over an existing store, and the trust is off unless the new flags are set. |
Brings in #3018 (AS-2 trusts the hosted AS-1 in production). The broker keeps both the audit sink's close and main's AS-1 trust, and the CLI reference is regenerated with both flag sets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #2533. Stacked on #3015; review that first.
#3015 made the embedded gateway's authorization server (AS-2) able to trust AS-1 in ToolHive's
resolvemode. This PR turns that trust on in production, from mecak8s's configuration.Changes
Startup builds AS-2's trust from the hosted AS-1. It uses:
AS-2 and AS-1 therefore can't disagree on the IdP or the identifying claim. The trust is carried on the AS-1 the broker uses (
IdentityBrokerAS1.AS2Trust), so tests with an external AS-1 set it in the same place. No top-level test-only trust remains.New settings (flags, with matching Helm values under
identityBroker.as2). All of them require--identity-broker-as1-issuer:--identity-broker-as2-upstream-client-idand--identity-broker-as2-upstream-client-secret-file: AS-2's own client at the company IdP, with redirect URI<AS-2 issuer>/oauth/callback.--identity-broker-as2-as1-ca-fileand--identity-broker-as2-as1-allow-private-addresses: for an AS-1 issuer at a private address or behind a private CA, when AS-2 fetches AS-1's keys. Allowing private addresses requires the CA.Gateway entry. Servers are accepted once AS-1 is hosted and AS-2's client is set.
Helm: values, schema (
as2is optional, so--reuse-valuesupgrades keep working), flag rendering, read-only Secret mounts, theextraArgsban extended to--identity-broker-as2-*, and the "servers must stay empty" rule replaced.Operator guide:
Server CLI reference regenerated.
New shortcut marker: a cancelled or failed provider leg fails a user's whole first sign-in at AS-2. Removed by Connect link for a missing provider connection, through the gateway's URL elicitation #2973, after Embedded runner: an option to set NonFatalSecondaryLegs toolhive#7370.
Kept shortcuts (in #2451's table)
typother thanat+jwt(vMCP: optionally refuse JWT access tokens whose typ is not at+jwt (RFC 9068) toolhive#7345).Tests
TestHostedAS1GatewayCallFromFlagsstarts mecak8s from flags only: hosted AS-1, servers in the gateway entry, and no test-only trust. Before Alice signs in at AS-2, the call is refused withsubject_unknown. Afterwards it gets a marked gateway token naming her AS-2 user, the agent and the vMCP, and the served vMCP accepts the token.TestHostedAS1ComposesAS2sTrust: the composed trust carries AS-1's subject claim (oid), IdP issuer and CA. AS-2's key-fetch private-address setting and the IdP's are kept separate. There is no trust without AS-2's client.TestHostedAS1KeysAtAPrivateAddressNeedTheSetting: a private key-set address without the setting fails startup.TestBuildRefusesGatewayServersAS2DoesNotTrust,TestBuildRefusesAS2SettingsThatWouldDoNothing.as2, so the nil path is exercised.API compatibility
No wire change for existing clients. The new flags and Helm values are additive and off by default, and with them unset nothing changes. With them set, calls to servers listed in the gateway entry fail closed until #2537.
Testing
go testpasses for./internal/adapter/mcpbroker/...,./internal/identitybroker/...,./internal/app,./cmd/mecak8s,./deploy/helm/mecak8s/...and./deploy/mecak8s-idbroker/....task deploy:helm-unittestandtask deploy:checkpass.task docs:checkandtask site:buildpass, andgolangci-lintreports no issues.task docs:server-cli:checkis the one exception: it reports a difference on the existing--workspacedefault line. That line wraps by the local checkout path's length. The new flags' sections match the generator exactly.After merge
resource_denied, which AS-2's configuration can't produce.