Registry Mirror
Skip to content

Conversation

@lakhansamani

@lakhansamani lakhansamani commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Phase 4a, part 3a. Stacked on #954.

  • Clients: a "Human approval (CIBA)" switch on create/edit, sent as backchannel_token_delivery_mode ("poll" / ""), with help text saying it also needs --enable-ciba and openid in the allowed scopes; a CIBA badge in the clients list.
  • Webhooks: user.approval_requested in the event picker.
  • Email templates: the ciba_approval event. The variable picker shows its variables (agent_name, binding_message, approval_url, expires_in_minutes, resource) only for that event, and hides verification_url there.

Verified: tsc --noEmit clean, vitest run 50/50, vite build ok, Prettier clean.

Update: the audit log filters now list the six CIBA events (including ciba.expired from #958) and the service_account resource type, which CIBA decisions are recorded against. Design §10 called for this, and it was missing.

…mode

Adds backchannel_token_delivery_mode to the admin client API (GraphQL
_create_client/_update_client/Client, gRPC/REST CreateClient/UpdateClient/
Client). "poll" registers the client for CIBA (OpenID CIBA Core 1.0 §4),
"" removes it, omitted leaves it unchanged; any other value is refused.

Stored as the CIBA grant URN in the existing grant_types column (written
by every backend's full-record UpdateClient), so no schema change. Other
grant types on the row are preserved. Dynamic registration still accepts
only authorization_code/refresh_token, so it cannot enable CIBA.

Nothing reads the flag yet; the CIBA endpoints follow in the next PR and
are additionally gated server-wide by --enable-ciba.
…(beta)

Implements phase 4a of the CIBA design (authorizerdev/docs#112), off by
default behind --enable-ciba and a per-client opt-in.

- POST /oauth/bc-authorize (CIBA Core 1.0 §7): service accounts only;
  login_hint (user id) or id_token_hint (signature verified, aud must
  contain the client, accepted up to 30 days expired per §14); required
  binding_message (≤64 chars, no Cc/Cf); RFC 9396 authorization_details
  limited to --ciba-authorization-details-types; exactly one external
  resource (never Authorizer itself); no authorizer: scopes. Unknown,
  revoked, out-of-org, capped and blocked users get the same answer and
  the same storage round trips (timing probe test).
- GET/POST /oauth/bc-approve: session cookie only (ValidateBrowserSession,
  never bearer); step-up via --ciba-step-up-max-age and no magic-link
  sessions, reusing forceReauth's revocation (now revokeBrowserSession)
  and the SAML-style /app login detour (isCibaApproveURL in the login
  UI); single-use per-render form token bound to the session plus an
  Origin check; approve / deny (1h block) / deny-and-block (24h).
- CIBA grant at /oauth/token: authorization_pending, slow_down (+5s),
  expired_token, access_denied, single redemption. Issues a 5-minute
  delegated token (act.sub = agent, aud = resource, authorization_details
  and ciba{req,msg,approved_at} claims, no sid so it cannot authenticate
  at Authorizer) and a scope-redacted ID token (amr from the approving
  sign-in). Token response carries scope and authorization_details
  (RFC 9396 §7).
- Channels: ciba_approval email template and user.approval_requested
  webhook, sent in the background.
- Discovery fields, audit events (ciba.*), metrics, startup validation
  (TLS --url per §7) and warnings (no SMTP, magic-link-only sign-in,
  own origin missing from --allowed-origins).
- Client assertion aud: issuer/token/backchannel URLs accepted at the
  backchannel endpoint when expected_aud is one of them (CIBA §7.1).

Tests: integration (poll flow, approval page auth/CSRF/step-up, deny and
block, caps, org boundary, unknown users, validation, id_token_hint,
timing probe), unit, release smoke against the real binary.
…air caps, atomic stores

From the implementation security review:
- High: token exchange accepted a CIBA access token as subject_token and
  minted a token for any resource without authorization_details or the
  ciba claim, with a fresh lifetime. Refuse subject tokens carrying a ciba
  or authorization_details claim (regression test fails without it).
- Medium: the cross-client per-user total counted undeliverable requests,
  so one agent (blocked, out of org, over its own cap) could silence all
  others. Count only deliverable requests; the other path reads the
  counter so both paths make one storage round trip.
- Medium: on DynamoDB and Cassandra/ScyllaDB the database memory store's
  SetCacheNX is an upsert, so single redemption and first decision were
  not atomic. --enable-ciba now requires --redis-url there.
- Low: resource check compares hosts only (scheme, port, trailing dot
  ignored); authorization_details labelled as the agent's unverified
  description; Zl/Zp refused; TTLs floored at 1s; user.* variables passed
  to the ciba_approval email; Root.tsx doc comment back in place.
TestCIBACaps took the email count right after three requests, while the
third email could still be sending in the background, so a late email
was counted as a fourth (flaky in CI). Wait for all three first.
- Clients: "Human approval (CIBA)" switch on create/edit, sent as
  backchannel_token_delivery_mode ("poll" / ""), and a CIBA badge in
  the list.
- Webhooks: user.approval_requested event.
- Email templates: ciba_approval event, with its variables (agent_name,
  binding_message, approval_url, expires_in_minutes, resource) shown only
  for that event, which has no verification_url.
backchannel_token_delivery_mode="poll" is refused for a client that is
not a service account (the backchannel endpoint rejects every other kind)
and for one whose allowed_scopes lack openid (every CIBA request must
include it), including when an update removes openid from a CIBA client.
Found in review.
… blocks, MFA detour

- Enumeration: undeliverable requests now increment a shadow counter instead
  of reading the total, so every path makes the same storage calls. On the
  database memory store (the default without Redis) IncrementCache is
  several statements, so known users were measurably slower. New
  TestCIBAUserCanBeAskedStorageParity records the calls for deliverable,
  unknown, revoked, blocked, capped and out-of-org users and requires them
  identical; it fails on the previous code.
- Resource check: same host AND port is Authorizer (default ports 80/443
  count as one, trailing dot and case ignored). Host-only comparison
  refused every API on localhost, so local development could not work.
- Deny-and-block uses its own 24h key, so a later plain deny cannot shorten
  it; a failed block write is logged at warn.
- Sign-in detour carries mfa_required/mfa_methods/mfa_gate to /app, so a
  social or SSO login stopped for MFA continues instead of looping.
- --ciba-poll-interval minimum is 2 (1 made exact one-second polling get
  slow_down on the in-memory store).
- Tests: CIBA flow and approve/deny race on the database memory store;
  approve after expiry; plain deny blocks and cannot shorten a 24h block;
  revoked user indistinguishable when polled; bearer test uses the
  request's own user's token; background sends are drained instead of
  slept on before 'nothing was sent' assertions.
#957 makes the database memory store's single-use claim atomic on every
backend, so CIBA's first-decision-wins and single redemption hold without
Redis. Merge after #957.
@lakhansamani
lakhansamani changed the base branch from feat/ciba-poll to main November 30, 2026 14:52
…ters

The design (§10) puts the new events in the audit filters; they were
missing, including ciba.expired from #958. CIBA decisions are recorded
against the agent's service account, so that resource type is filterable
too.
@lakhansamani
lakhansamani merged commit df92332 into main Dec 1, 2026
8 checks passed
@lakhansamani
lakhansamani deleted the feat/ciba-dashboard branch December 1, 2026 07:05
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.

1 participant