Skip to content

fix(identitybroker): deny calls on AS-2 actor_denied - #2826

Merged
ChrisJBurns merged 1 commit into
docs/as2-redemption-error-contractfrom
fix/identitybroker-as2-access-denied
Nov 17, 2026
Merged

ChrisJBurns merged 1 commit into
docs/as2-redemption-error-contractfrom
fix/identitybroker-as2-access-denied

Conversation

@jhrozek

@jhrozek jhrozek commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Why: AS-2 is moving to ID-JAG -06's redemption errors (Authorization server: reason codes in error_description for ID-JAG redemption refusals toolhive#7030, #6887). A valid ID-JAG it won't accept comes back as access_denied with subject_unknown, actor_denied or resource_denied. The design in docs(agent-identity): follow ID-JAG -06 for AS-2 redemption errors #2825 says actor_denied denies the call, and the broker today reports all three as unknown and fails with INTERNAL.
  • What:
    • access_denied is a known error code; subject_unknown, actor_denied and resource_denied are known reasons. resource_denied is a configuration fault; actor_denied isn't.
    • redeemFailure answers access_denied + actor_denied with PERMISSION_DENIED and the denied reason, the same error AS-1's denied produces. No retry. A 503 carrying it stays UNAVAILABLE.
    • subject_unknown, resource_denied and a reasonless access_denied still fail with INTERNAL and no retry. subject_unknown → pending with a sign-in link waits for a real gateway.
    • The consent_required test rows use access_denied, as the design now says. The code matches on the reason alone, so behaviour doesn't change.

Stacked on #2825. Nothing changes until we bump ToolHive past the AS-2 work; v0.65.0 never sends these.

Issue relationship

Relates to #2654

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

Baseline checks

  • Linting (task lint)
  • Fast offline test suite (task test): ran the focused suites instead, below
  • Pre-review race suite (task test:race): not run; focused race tests below
  • Offline demo (go run ./cmd/mecademo): not affected
  • Markdown changed: docs generation/link checks (task docs): no markdown
  • User docs/user-facing behavior changed: site build (task site:build): not applicable
  • Guarded engine API affected: compatibility check (task api:check): not applicable
  • Intentional engine API change: task api:update + engine/CHANGELOG.md: not applicable

go test -race ./internal/identitybroker/... ./internal/adapter/mcpbroker/... passes. New rows in TestAuthorizeCallMapsAS2Refusals and the server-refusal tables, each checking a single redemption (no retry).

User-facing change

None today: production configures no AS-2 gateway and we pin ToolHive v0.65.0. Once both change, an agent whose actor AS-2 refuses sees the call denied instead of an internal error.

AS-2 is moving to ID-JAG -06's redemption errors (design: credentials
and lifecycle, step (8) and error reasons): access_denied with
subject_unknown, actor_denied, or resource_denied, alongside the
invalid_grant and invalid_target it already sent.

Add access_denied and the three reasons to the known codes and reasons,
so they are no longer reported as unknown. resource_denied joins the
configuration faults; actor_denied does not, because it is a denial.

redeemFailure now answers access_denied with actor_denied as
PERMISSION_DENIED with the denied reason, as AS-1's denied is, without
a retry. subject_unknown, resource_denied, and a reasonless
access_denied stay INTERNAL.

Co-authored-by: Mecatl <[email protected]>
@jhrozek
jhrozek marked this pull request as ready for review November 17, 2026 10:27
@ChrisJBurns
ChrisJBurns merged commit 0ac01e6 into docs/as2-redemption-error-contract Nov 17, 2026
50 of 69 checks passed
@ChrisJBurns
ChrisJBurns deleted the fix/identitybroker-as2-access-denied branch November 17, 2026 17:42
ChrisJBurns pushed a commit that referenced this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants