Repository navigation
Description
Problem
checkDelegationConsent (pkg/authserver/server/tokenexchange/handler.go),
consent path 1: when a subject token carries a well-formed may_act claim,
it is authoritative — resolveAllowedActor/AllowedActors is skipped
entirely (by design, per #5989's original consent-model decision: "If the
subject token carries may_act ... it is authoritative"). The only remaining
check is AllowedDelegateClients, which validateTrustedIssuer explicitly
permits to be the wildcard "*" ("any ToolHive client holding the
token-exchange grant").
So: any external IdP that can be induced to emit a may_act claim — a
claim-mapping misconfiguration, or an IdP that maps a user-editable profile
field into a claim — can name any ToolHive client as delegate, for any
issuer where AllowedDelegateClients is wildcarded. Requiring
may_act.iss == selfIssuer-style checks doesn't help; may_act's fields are
attacker/issuer-controlled by definition on the external path. This is
exactly the confused-deputy pattern (CWE-863) AllowedActors was built to
close, reopened through the one consent path deliberately designed to bypass
it.
This was an accepted, deliberate design tradeoff in #5989 (a per-RFC-8693-§4.4
authoritative signal), not a bug — but the risk profile changes as
AllowedDelegateClients: ["*"] becomes a more common, even recommended,
configuration (see the ActorMatcher/client-assertion-auth extension issue,
which pairs naturally with a wildcarded AllowedDelegateClients). What was a
narrow, deliberately-accepted edge case becomes a live default-configuration
concern.
Proposed fix
Add a per-issuer AllowMayAct bool (default false) to TrustedIssuer.
When false (the default), the external validator / checkDelegationConsent
reject a may_act-bearing subject token from that issuer outright, rather
than silently trusting it (external tokens have no client_id-binding
fallback, so there is nothing softer to fall back to). Operators who
genuinely need may_act support from a specific issuer opt in explicitly.
Cost: per the arch doc's own language, "no major IdP emits may_act today,"
so a default of false should not break any known real-world configuration.
Also reject the combination AllowMayAct: true + AllowedDelegateClients
containing "*" at config-validation time — same posture as the existing
rule rejecting "*" combined with specific IDs in AllowedDelegateClients
(permissiveness must be a deliberate, singular declaration, not obtainable
by omission or by combining options).
Relationship to other issues
- Distinct from Harden act/may_act handling on the external-issuer token exchange path #6113 (may_act shape validation gap on the external
path,acthop missingiss, unboundedactsubtree size) — that issue
is about malformed/oversized claims reaching the handler; this one is
about the consent model itself trusting a well-formedmay_acttoo
broadly by default. Both are real and independent; given Harden act/may_act handling on the external-issuer token exchange path #6113's own "why
one issue" note about touching the same two files, this one should
probably land as its own PR since it touchesTrustedIssuervalidation and
checkDelegationConsent's branch order, not claim shape/size. - Interacts with the
ActorMatcher/AllowClientAssertionAuthissue: that
issue'sAllowedDelegateClients: ["*"]recommendation is the reason this
one's severity is going up, not the cause of the underlying gap. Land this
one first or alongside it.
Activity
Harden external may_act delegation
Harden external may_act delegation
Harden external may_act delegation