IBEX Harness
DocsBenchmarksBlogChangelogRoadmap
GitHub
IBEX Harness

Documentation

HTTP route inventoryAuth gRPC (ValidateToken, ValidateAgent)Health and metricsChat completionsErrors
API Reference›Auth gRPC (ValidateToken, ValidateAgent)
API Reference

Auth gRPC (ValidateToken, ValidateAgent)

Internal AuthService RPCs consumed by the proxy — not exposed on the public internet.

The auth service exposes ibex.auth.v1.AuthService on IBEX_GRPC_PORT (default 9091). The proxy is the primary caller. Management RPCs (CreateToken, RevokeToken, ListTokens) are available on the same service — see Issuing API keys.

Internal only

Do not expose port 9091 to the public internet. Production uses mTLS on the internal mesh. Contract policy: ADR-0006.

Service definition

Full AuthService surface from the proto (proxy hot path uses Validate*; token lifecycle uses Create/Revoke/List):

protobuf
service AuthService {
  rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
  rpc ValidateAgent(ValidateAgentRequest) returns (ValidateAgentResponse);
  rpc CreateToken(CreateTokenRequest) returns (CreateTokenResponse);
  rpc RevokeToken(RevokeTokenRequest) returns (RevokeTokenResponse);
  rpc ListTokens(ListTokensRequest) returns (ListTokensResponse);
  rpc IssuePolicySnapshot(IssuePolicySnapshotRequest) returns (IssuePolicySnapshotResponse);
}

Source: packages/proto/proto/ibex/auth/v1/auth.proto

ValidateToken

Called on every protected proxy request before the handler reads the body. No caller metadata is required on the hot path.

RPC: ibex.auth.v1.AuthService/ValidateToken

Parse and verify a bearer PAT; return tenant context on success.

Request

ParameterTypeDescription
access_tokenRequiredstring
Full bearer value from Authorization header (e.g. ibex_pat_…). Never log in implementations.

Response (success)

ParameterTypeDescription
org_idRequiredstring (uuid)
Organization scope for RLS and rate-limit keys.
permissionsRequiredint64
Permission bitmap — see ADR-0009 and packages/permissions.
agent_idstring (uuid)
Optional: agent_id, user_id, token_id, expires_at when present on token.

gRPC status codes

gRPC codeMeaning
OKToken valid
UnauthenticatedMissing, malformed, expired, or revoked token
InternalPostgres or hashing failure (logged server-side)
DeadlineExceededExceeded proxy-side validate budget

Proxy maps transport failures to HTTP 503 SERVICE_DEGRADED. See Errors.

ValidateAgent

Called after ValidateToken on protected routes. Confirms X-IBEX-Agent-ID belongs to the token org and is active.

RPC: ibex.auth.v1.AuthService/ValidateAgent

Request

ParameterTypeDescription
agent_idRequiredstring (uuid)
Value from X-IBEX-Agent-ID header.
org_idRequiredstring (uuid)
Org from ValidateToken response — never from the URL alone.

Response (success)

FieldTypeDescription
agent_iduuid stringEcho of verified agent
org_iduuid stringEcho of verified org
statusstringactive, paused, suspended, or archived

gRPC status codes

gRPC codeProxy HTTPIBEX code
OK200 (handler continues)—
PermissionDenied403AGENT_NOT_AUTHORIZED or AGENT_SUSPENDED
InvalidArgument400validation failure
Unavailable / transport error503AUTH_UNAVAILABLE

Cross-org agent lookups return PermissionDenied, not NotFound. Policy: ADR-0016.

IssuePolicySnapshot

Called by the proxy after ValidateAgent on protected routes (GAP-002). Mints an immutable RS256-signed policy-snapshot.v1 envelope binding org, subject, selected agent, permissions, epoch, and issue/expiry times. The envelope is verified locally by the proxy against IBEX_PROXY_POLICY_PUBLIC_KEYS before any effect.

RPC: ibex.auth.v1.AuthService/IssuePolicySnapshot

Request

FieldTypeDescription
agent_iduuid stringSelected agent; required for agent-scoped tokens and must equal the token binding. Org-scoped tokens may select any agent in the org (the proxy previously verified membership).

Caller identity (org, token/subject, permissions) comes from the authenticated bearer metadata — never from request fields.

Response (success)

FieldTypeDescription
envelope.algorithmstringAlways RS256
envelope.key_idstringPolicy-signing key id (for rotation)
envelope.payloadbytesJCS-canonical policy-snapshot.v1 claims JSON
envelope.signaturebytesRSA PKCS#1 v1.5 SHA-256 signature over payload

gRPC status codes

gRPC codeProxy HTTPIBEX code
OK200 (handler continues)—
Unauthenticated401INVALID_TOKEN
PermissionDenied403AGENT_NOT_AUTHORIZED
InvalidArgument400validation failure
FailedPrecondition503SNAPSHOT_UNAVAILABLE (signing key not configured)
Unavailable / transport error503SNAPSHOT_UNAVAILABLE

TTL defaults to 60s; consumers bound accepted age per operation class (30s mutation, 60s read, 5s clock skew).

Example (grpcurl)

bash
grpcurl -plaintext -d '{"access_token":"ibex_pat_…LOCALDEVELOPMENTONLY"}' \
  localhost:9091 ibex.auth.v1.AuthService/ValidateToken

Requires make db-seed, running auth, and make proto-gen stubs.

Related

  • Authentication — required HTTP headers
  • Errors — HTTP envelope for proxy-facing failures

Was this page helpful?

Edit on GitHub

Last updated on

PreviousHTTP route inventoryNextHealth and metrics

On this page

  • Service definition
  • ValidateToken
  • Request
  • Response (success)
  • gRPC status codes
  • ValidateAgent
  • Request
  • Response (success)
  • gRPC status codes
  • IssuePolicySnapshot
  • Request
  • Response (success)
  • gRPC status codes
  • Example (grpcurl)
  • Related
0%