Skip to content

Identity broker settings #2813

Done

Description

@ChrisJBurns

Depends on: #2538 (the broker's configuration loader)

Mecatl change in configuration.

Problem

The identity broker's lifetimes, clock skews, timeouts, and retention periods are fixed values in code, so an operator cannot set them or see what risk each bounds.

Design

Requirements

  • Settings: an identity broker section in the broker's own configuration file (--identity-broker-config, Keys and gateway entries for the identity broker #2538), read and validated by Keys and gateway entries for the identity broker #2538's loader. The file is not part of the generated settings.yaml configuration reference. Durations are Go duration strings (for example "12h"), as ToolHive takes them.
    • These values from credentials-and-lifecycle.md ("Configuration"), each replacing an interim fixed value:
      • AS-1's maximum lifetime for grants that issue ID-JAGs, set as ToolHive's exchange_refresh_tokens.id_jag_max_lifetime on the mecatl client (Add exchange refresh token client config toolhive#6989), at most 720h. It replaces the 12-hour constant, and it is also every session's hard expiry;
      • the ID-JAG lifetime: one value applied to every gateway entry's ID-JAG target at AS-1, in whole seconds from 1s to 300s (ToolHive's bounds; default 60s). It also bounds the gateway token's lifetime, which AS-2 caps at the ID-JAG's remaining validity. A per-entry override can come with External gateway: Gateway implementation, operator setup, and end-to-end test #2812;
      • the agent credential lifetime, at most the fixed MaxCredentialLifetime ceiling. It replaces the interim one-hour lifetime in the broker's configuration loader;
      • the client-assertion lifetime the broker signs, at most 60 seconds. ToolHive's own bound on client assertions is fixed, and the design accepts it (step (5) check 5), so AS-1 and the embedded AS-2 get no client-assertion setting;
      • the clock skew. One setting replaces both credentialClockSkew and convertedClockSkew. Keep the rule in convertedClockSkew's comment: the converted-jti retention must cover at least the skew AS-1 allows on an access token's exp (zero today; pin that with a test). The skew applies inside the broker only, not at AS-2 or the vMCP;
      • the request timeouts for the broker's in-process calls to AS-1 and to AS-2, replacing the 10-second constants. The AS-1 timeout bounds how long session open holds the host session's open lock, so it has an upper bound; record for Sign-out and revocation #2568 that it must exceed the upstream re-check's lease wait plus the IdP call.
    • Refuse a configuration that cannot work: a clock skew not well below the ID-JAG grant maximum (every session would be past its hard expiry); id_jag_max_lifetime or the ID-JAG lifetime without a hosted AS-1; values out of the bounds above.
    • The ID-JAG grant maximum (id_jag_max_lifetime) and the schedule-horizon maximum (refresh_token_max_lifetime, Phase 2, Slice 3: Scheduled runs — A scheduled run calls gateway tools on its own grant, with no one present #2569) are separate settings. Never derive one from the other, so a schedule's horizon is not trimmed to a session's hard expiry.
    • Document each default and the risk it bounds. For the ID-JAG grant maximum, the operator guide states that a session whose agents keep running past it loses gateway access until the user's next request reopens it.
  • Owned elsewhere: AS-1's issuer stays a mecak8s flag. The gateway token's own lifetime at the embedded AS-2 is Bind each gateway token to its call #2727's, once Authorization server: narrow a JWT-bearer access token to one MCP call with authorization_details toolhive#7061 adds per-client lifetimes. Refreshing a key set on an unknown kid is Identity broker credential renewal and key rotation #2562's, closed-session retention Durable broker state and recovery #2563's, and the workload credential lifetime Broker over gRPC, authenticated as the mecak8s workload #2559's. How long AS-2 keeps used ID-JAG jtis needs no setting: AS-2 checks exp strictly and keeps each until then.

Later tickets that need a value of their own (#2559, #2562, #2563, #2568, #2569, #2727) add it to the same file, following the same conventions.

How it fits

Slice 7: makes the broker's limits operator-controlled. The Helm chart (#2814) delivers them.

Done when

Each value above is a documented setting with its default and the risk it bounds, the interim constants are gone, unworkable combinations are refused at startup, the operator guide documents each setting in the broker's configuration file, and with the flag off nothing changes.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions