Skip to content

Design

Markdown · llms.txt

Status: v0.4.0. Steps 1 to 6 are implemented: caller authentication by WIT with WPT or HTTP signatures, mTLS, JWT-SVID and OAuth access tokens, bearer or DPoP-bound; AAT, asor-03 and RFC 8693 act chains (decoders and per-format checks, then the format-neutral invariant engine and an authority algebra per detail type); audit events, OpenTelemetry spans and the chain view; revocations received as OpenID Shared Signals. Items marked Open need a decision before the code that depends on them.

One ext_authz Check call runs these steps in order and stops at the first failure.

inbound request (via Envoy / Istio / agentgateway ext_authz)
1. sanitize check the target, ignore forwarding headers (strip them on an allow)
2. authenticate Authenticator -> Authenticated (caller id, method, bound user token, proof key)
3. chain ChainDecoder plugins -> NormalizedChain -> invariant engine -> authority algebra
signals user token and chain principal against received Shared Signals revocations
4. authorize AuthZEN 1.0 evaluation request -> decision (fail closed)
5. mint Txn-Token (typ txntoken+jwt) -> ok_response header, credential and chain headers removed
6. record audit record + OpenTelemetry span + reason code
  • Deny requests for authorities outside allowed_authorities, and request targets an upstream could read differently from the path the PDP sees (request.unnormalized_path, listed in docs/bindings.md).
  • After steps 2 and 3, an inbound Txn-Token is accepted only from a workload listed in internal_callers that proved possession of a key for the request (WIT with WPT or HTTP signature, or mTLS). It is verified and forwarded unchanged, or replaced when this hop verified a chain (tctx.chain:<caller>). From anyone else it is denied (txn.untrusted_hop).
  • Never forward the inbound access token downstream (MCP security best practices, Txn-Token draft §13). Authorization, Workload-Identity-Token, Signature-Input, Signature, AAT-Chain, AAT-PoP, Agent-Delegation-Chain, DPoP and the user token header are removed from an allowed request.
  • Never read Forwarded or X-Forwarded-* for a decision. On an allow, remove the ones a client can set to name another host, port, prefix or path (Forwarded, X-Forwarded-Host, -Port, -Prefix, -Uri, and X-Original-URL, X-Rewrite-URL), whatever the previous hop. X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Client-Cert stay with the proxy, which sets or sanitizes them (Envoy use_remote_address, forward_client_cert_details).

visado_credentials::Authenticator picks one method by what the request carries:

Method Input Built on
wit-wpt Workload-Identity-Token + Authorization: WPT wimsey-wit, wimsey-wpt
wit-httpsig WIT + RFC 9421 signature wimsey-httpsig (needs with_request_body for digests)
mtls peer certificate from CheckRequest.attributes.source wimsey-mtls, SPIFFE X.509-SVID, one CA per trust domain
jwt-svid bearer JWT-SVID jsonwebtoken, SPIFFE bundle file per trust domain
oauth-at bearer or DPoP-bound access token jsonwebtoken (RS256 needed for Dex and Keycloak), configured JWKS

Trust rules:

  • Trust anchors and JWKS locations are configured per trust domain. Keys are never fetched from URLs found inside a token.
  • Audience is an exact string match.
  • Clock leeway is 30 s, at most 60 s (Authenticator::with_leeway); the server file does not set it.
  • WPT jti, HTTP signature nonce and DPoP jti replay are checked against bounded caches, one per proof type, each with a per-caller quota (see bindings.md).
  • DPoP proofs can be required to carry a server-provided nonce (RFC 9449 §9). Nonces are stateless (an issue time under an HMAC), so replicas that share the key accept each other’s.

Method selection, the Envoy settings each method needs, and their limits are in bindings.md.

Three layers, so a new draft is a new plugin:

  1. A decoder per format (ChainDecoder for AAT and asor, visado_chain_act::Verifier::decode for act) parses, canonicalizes, checks signatures and links (par_hash, or nesting only), and produces a NormalizedChain. The format’s request checks (proof of possession, status, audience, action) follow in the same crate.
  2. A format-neutral invariant engine (visado_chain::invariants::Engine) then checks the normalized chain again, whatever the format. The per-format checks stay; the engine must agree with them, and the gate runs it on every chain after them. In order, each with its deny code:
    • shape: one to 32 hops, depths 0..n in order (chain.malformed)
    • links: the first hop is the root, signed by the trust anchor; every later hop names its parent’s actor as delegator and is signed by the key its binding names, the parent’s cnf or the anchor; a nested hop shares its parent’s token (chain.link_mismatch)
    • the principal never changes (chain.principal_altered)
    • exp is monotone: no hop outlives its parent (chain.exp_extended)
    • depth limits hold, read per profile (DepthSemantics::{AsorStrict, AatHolderCap, Uncapped}, see below; chain.depth_exceeded)
    • audiences only narrow: a hop’s audience is a non-empty subset of the restriction in force, and a hop without one inherits it (chain.audience_widened)
    • no delegation token repeats (chain.token_repeated). A holder may repeat: AAT-02 §6.2 lets a holder derive a token for itself, and the AAT vectors cycle keys
    • verified hops end the chain and the leaf is verified (chain.unverified)
    • every verified hop’s authority type has an algebra (chain.unknown_authority), and each verified hop’s authority is subsumed by its verified parent’s (chain.scope_escalation)
    • status holds: no status reference is left unchecked (chain.status_unchecked)
    • proof of possession holds: holder_proof is true (chain.no_holder_proof)
    • the action is allowed: the leaf’s authority permits it (chain.action_denied)
  3. An AuthorityAlgebra per RAR detail type implements subsumes(parent, child) and permits(leaf, action); an Algebras registry maps a type to its algebra, and unknown types are denied. Each format crate implements its own type, from the same rules its decoder applies: attenuating_agent_token (AAT §8 step 4p and step 6b), agent_delegation (asor §4.3 rules 1 to 3 and step 8, without running totals) and rfc8693-act (only the empty authority, which subsumes only itself and permits a request only when no action is asked of the chain, since RFC 8693 gives an actor no authority; the gate asks none of an act chain).

del_max_depth means different things in the two drafts, so the engine reads Hop::max_depth per profile, fixed by the profile rather than configured, and the audit record of an accepted chain names it (depth_semantics):

  • AsorStrict (asor-03): only the first hop’s bound limits the chain. Hop::max_depth is DT_0.del_max_depth - 1 on every hop; every depth must be at most it.
  • AatHolderCap (AAT-02): every hop carries its own cap. Each depth is at most its hop’s max_depth, and no hop raises its parent’s.
  • Uncapped (RFC 8693 act): no per-hop bound; the adapter’s max_actors and the engine’s 32 hops apply.
struct NormalizedChain { profile: Profile, principal: Principal, root: TrustRef, hops: Vec<Hop>, holder_proof: bool }
struct Hop {
id: String, depth: u32, max_depth: Option<u32>, actor: ActorId, principal: Principal, delegator: Option<ActorId>,
signer: KeyThumbprint, signer_binding: SignerBinding, // RootAnchor | ParentCnf
link: Link, // Root | ParHash | Nested
authority: Authority, validity: Validity, audience: Option<Vec<String>>, cnf: Option<Cnf>,
status: Option<StatusCheck>, // Unchecked | Valid
assurance: Assurance, // Verified | Declared
}

Only Verified hops are used for authorization, and only when holder_proof is true: the presenter proved possession of the leaf key for this request. ChainDecoder::decode checks the chain only and sets it to false. Declared hops, such as prior actors in a nested RFC 8693 act claim, go to the Txn-Token context and the chain view only.

Order of formats:

  1. AAT (draft-niyikiza-oauth-attenuating-agent-tokens-02): 229 published vectors, and each hop is signed by the parent’s cnf key.
  2. asor (draft-asor-wimse-agent-delegation-chain-03): 36 published vectors; every hop is signed by a trust anchor, the leaf key is proven with DPoP, and each status reference is checked against a Token Status List the gate holds.
  3. RFC 8693 act adapter: the actors of a verified access token’s act claim, signed by its issuer. The current actor is Verified once it is bound to the authenticated caller; prior actors stay Declared and never reach the PDP, as RFC 8693 §4.1 requires. Its actors have no key; the gate reads the chain only from a user token bound to a WIT caller, or from a DPoP-bound access token, so the caller proved possession of a key for the request and holder_proof is true there.
  4. Delegate SD-JWT once it has vectors.

With [ssf] configured, the gate checks the user token and the sub principal of a verified chain against revocations received from OpenID Shared Signals Transmitters, after the chain step and before the PDP. visado-ssf holds the protocol and the store; the server does the I/O.

  • Each [[ssf.streams]] names a Transmitter issuer. Its keys and verification endpoint come from the Transmitter Configuration Metadata at /.well-known/ssf-configuration under the issuer (SSF 1.0 §7.2), whose issuer must match. Keys are fetched again every key_refresh and, at most every 30 s, when a SET names an unknown key.
  • Delivery is push (RFC 8935: POST to push_path on the HTTP listener, application/secevent+jwt, Authorization compared with push_authorization_env) or poll (RFC 8936: poll_endpoint every poll_interval, acknowledging what verified and reporting what did not in the next request).
  • A verified CAEP session-revoked or credential-change, or RISC account-disabled, account-purged or sessions-revoked, revokes an iss_sub, email or opaque subject for horizon seconds after the event. subject_issuers lists the token issuers the stream may revoke.
  • A token issued before the event is denied: ssf.session_revoked or ssf.credential_changed (401 with a challenge, so the caller gets a new token), ssf.account_disabled (403).
  • A stream that has not proven itself within max_staleness (a successful poll, or any verified SET, including the Verification events visado asks for every verify_interval) denies the tokens of its subject_issuers with ssf.stream_stale (503). A full store that had to drop a revocation denies them with ssf.store_full (503) until that event’s horizon passes.
  • The lookup hashes the issuer and value with SHA-256 and reads a HashMap under a read lock; it allocates nothing, and a token from an issuer no stream covers costs one pass over the streams. cargo bench -p visado-ssf times it.
  • The store is in memory and per replica; a restart loses it, and each replica needs its own push or poll. Choices against the specs are in SPEC-MAP.md.

AuthZEN 1.0 POST /access/v1/evaluation at the configured [pdp] endpoint. visado_authzen::discover reads the endpoint from /.well-known/authzen-configuration; the server does not use it yet.

Open: the agent-and-principal profile. AuthZEN does not say how to carry an agent acting for a user. What visado sends:

  • subject is the caller (type: agent, or client for an OAuth client; id: its identifier).
  • resource is type: http_resource with scheme://authority/path as id; action.name is the HTTP method.
  • context.principal is the user (type: user), when the caller acts for one.
  • context.scope, context.auth_method and context.txn.
  • context.chain for a verified chain: profile, issuer, depth, holders (key thumbprints, root first), the leaf’s authority and the principal. An act chain has its own shape (bindings.md).

To be proposed to the AuthZEN WG once it works end to end.

  • X-Request-ID is set to the txn value and checked in the echo.
  • Timeouts, transport errors, non-200 responses or a non-boolean decision all deny.
  • The PDP endpoint must be https or a loopback http address: whoever answers it decides the request. [pdp] allow_insecure_http = true allows plain http to another host, for a network nothing else can reach, and logs a warning at startup. bearer_env always needs https or loopback. The endpoint, the OTLP endpoint and the status list URIs must not carry user:password@; the startup log names the PDP by scheme://host:port only.
  • [pdp] context_in_subject also copies the context members into subject.properties, for PDPs that do not pass context to the policy (Cerbos).

Per draft-ietf-oauth-transaction-tokens-11:

  • Header typ: txntoken+jwt, signed with the trust domain’s key: Ed25519 or ES256, or RS256 when [signing_key] names an RSA private JWK of at least 2048 bits with the exponent 65537 (for recipients that verify RS256 only, such as kontxt). JWKS is published at /.well-known/jwks.json.
  • Claims:
    • aud: trust domain
    • txn: UUID, also the correlation id everywhere
    • sub: principal
    • scope: never wider than the authorized scope
    • req_wl: caller workload id
    • iat, exp: short, default 60 s
    • tctx: agent, auth_method, and chain as sent to the PDP (with prior actors for act)
    • rctx: method and resource
  • Injected with ok_response.headers (Txn-Token, overwrite), with the credential and chain headers in headers_to_remove. The txn also goes into dynamic_metadata for later filters and access logs.
  • Not built yet: a token endpoint (RFC 8693 profile) for services that want a Txn-Token without the gateway. Replacement is in visado-txn-token already: txn, sub and aud stay the same, scope never widens, and expired tokens are refused.
  • Open: there is no subject_token_type URN for a WIT. Use a private URN and propose one to the WIMSE and OAuth WGs.
  • One audit record per decision on stdout, as a JSON log line under visado::audit, the service’s own denials (request.no_http_attributes, request.invalid_header, internal.clock) included. Its members and hash are specified in audit.md. No credential is copied into it, JWS-looking text in any member is replaced by [token], and a claim that does not parse is described, not quoted.
  • It has the AIMS §11 minimum: agent, delegated subject and the verified chain, resource and MCP tool, action and decision, time and txn, posture inputs (auth_method, sender_constrained, the chain, pdp), and remediation with its cause (reason, detail). The records are hash-chained per process (seq, prev, hash) for tamper evidence. A denial from a received Shared Signal is recorded with its ssf.* code and, in detail, the event time and the token’s iat.
  • OpenTelemetry: one visado.authorize {target} span with http.request.method, url.full, visado.txn, visado.agent, visado.principal, visado.decision and visado.reason. Not yet: per-hop span events and GenAI or MCP semantic-convention attributes.
  • Deny reasons are stable, language-neutral codes, listed in bindings.md. The Transaction Token vectors share the txn.* codes. For example:
    • token.expired
    • wpt.replay
    • chain.link_mismatch
    • chain.scope_escalation
    • pdp.unavailable

Off by default. With [chain_view] enabled = true the gate keeps a summary of each recent decision in a bounded in-memory ring buffer (capacity, default 256, at most 10000; 0 keeps none; the oldest entry is dropped first, and everything is lost on restart). Denials of unauthenticated requests are recorded too, so anyone who can reach the proxy can push real entries out: the view is a debugging aid, not an audit trail, which is the visado::audit log. The HTTP listener serves:

Route Returns
GET /api/requests?limit=N {"capacity": n, "requests": [...]}, newest first; limit defaults to 100 and is capped by the capacity
GET /api/requests/{id} one summary, or 404 {"error": "not_found"}
GET /chain a single page (plain HTML, CSS and JS in crates/server/ui/, embedded with include_str!; no build step, no CDN) that polls the list every 2 s and draws principal → hops → caller → PDP → decision, with verified hops solid, declared hops dashed and the deny reason on the decision

A summary holds:

  • id: the check’s own identifier (the txn the gate would mint with), unique per check
  • txn: the transaction, which a forwarded Transaction Token keeps across hops
  • time, method, resource (scheme://authority/path, no query)
  • caller, auth_method, principal, each once known
  • decision, status, code
  • pdp: {"result": "allow" | "deny"} or {"result": "error", "code": ...}, or null when the PDP was not asked
  • chain: profile, issuer, principal, holder_proof, and per hop depth, actor_kind (key, name or subject), actor, actor_issuer, assurance (verified or declared), link (root, par_hash or nested) and the holder key thumbprint; only for a chain that verified

It never holds a token, proof, signature, digest, header value, body or the hop’s authority. The request path is shown as received, without the query: an upstream that puts a secret in the path (/hooks/<secret>) exposes it here, as it does in access logs. Strings are cut to 256 characters and chains to 32 hops (hops_omitted counts the rest).

  1. ext_authz server (v0): tonic + envoy-types gRPC. One server covers Envoy, Istio (CUSTOM action) and agentgateway, which vendors the same proto. The port listens on loopback unless [grpc_tls] requires the proxy’s client certificate or grpc_reachable_only_by_proxy is set (bindings.md).
  2. Token endpoint and UI (v0): axum for the RFC 8693 endpoint, JWKS, health, and the chain view (/api/requests, /chain; see Chain view). The token endpoint is not built yet.
  3. agentgateway ExtMcp (later): tool-aware AuthZEN requests at the MCP method layer.
  4. Standalone PEP (later, only if asked): hyper 1.x + tower + rustls. Not pingora, which brings its own lifecycle and OpenSSL by default.
crates/
txn-token mint, verify, replace (published on its own)
chain ChainDecoder trait, NormalizedChain, invariants, algebra, DPoP checks and nonces
chain-aat AAT decoder
chain-asor asor decoder and status lists
chain-act RFC 8693 act adapter
authzen AuthZEN 1.0 client and the agent profile
ssf Shared Signals receiver: SET validation, push and poll messages, revocation store
credentials caller authentication (wraps wimsey)
extauthz decision pipeline and Envoy ext_authz server
server binary: config, JWKS, chain view, telemetry, status list refresh
server/ui/ chain view (plain HTML, CSS and JS), embedded with include_str!
testkit test fixtures and the lab helpers (unpublished)
conformance/ vectors, one JSON file or directory per suite
fuzz/ cargo-fuzz targets
deploy/local/ a configuration for cargo run
deploy/lab/ compose file for the end-to-end lab

Not built as drawn. deploy/lab runs Keycloak as the Resource AS, redeeming ID-JAGs that Casdoor issues, since no Dex release issues them yet. The agents are demo.sh callers, not services; agentgateway routes /mcp to a small MCP server (deploy/lab/mcp), and the attack demos are in deploy/lab/attacks. The plan:

user --login--> Dex (ID-JAG issuance, master build)
agent A --ID-JAG--> Keycloak 26.7+ (Resource AS, experimental feature) --> access token
agent A (SPIRE WIT-SVID) --WIT+WPT, delegation token--> [Envoy + visado] --Txn-Token--> agent B
agent B --> [Envoy + visado] --> MCP server
visado --AuthZEN--> OPA with the AuthZEN plugin

Known setup constraints, from reading the code (not yet run):

  • the Dex client id must equal the Keycloak clientId
  • the ID-JAG audience must be the Keycloak realm issuer
  • Keycloak users must be pre-linked by Dex’s opaque sub

The attack demos, drawn from research/05-threats.md, run in deploy/lab today (attacks):

  • a prompt-injected agent widening its delegation
  • a stolen chain replayed by another workload
  • agent-to-agent escalation: a ticket recruits the admin agent
  • exfiltration within granted scope, which visado does not stop
  • Which ID-JAG revision to accept: the MCP extension cites -04 and the latest is -06. Proposal: accept both and record which one passed.
  • The Txn-Token draft does not define a representation of the call chain across replacement. visado carries the chain context in tctx.chain, and in tctx.chain:<caller> on a replacement (see SPEC-MAP.md). Open: whether to propose it to the OAuth WG.
  • Key storage beyond files (KMS/HSM) and per-trust-domain key separation.
  • Name of the WIT subject_token_type URN to propose.