ibexharness
DocsBlogReleasesRoadmap
GitHub
ibexharness

Documentation

OverviewIssuing API keysOrg and project modelMulti-tenant RLS
Auth›Issuing API keys
Auth

Issuing API keys

Create and rotate personal access tokens for agents and services.

Personal Access Tokens (PATs) are the Phase 1 client credential for IBEX Harness. Each token is scoped to an organization, carries a permission bitmap, and is verified by Argon2id hash lookup — only the hash is stored; the plaintext is shown once at creation (ADR-0007, ADR-0010).

Secret handling

Never log, commit, or paste PATs into tickets. Store in environment variables or a secrets manager. Log only an 8-character prefix in application code — see Secrets and keys.

PAT wire format

ibex_pat_<token_uuid>_<secret>

Example dev token (from make db-seed):

ibex_pat_00000000-0000-0000-0000-000000000004_LOCALDEVELOPMENTONLY

The auth service parses the prefix, looks up token_uuid in ibex_core.tokens, and verifies the secret with Argon2id. Revoked tokens fail immediately regardless of hash match.

Permission bitmap

Tokens encode capabilities as a 64-bit bitmap (ADR-0009). Common bits for proxy integrators:

BitNameNeeded for
—ProxyChatCompletionPOST /v1/chat/completions
—TokenCreateCreateToken gRPC
—TokenRevokeRevokeToken gRPC

ProxyChatCompletion is a composite of memory/session read bits — sufficient for Phase 1 chat probes.

Quick start with seed data

1

Migrate and seed

make db-migrate && make db-seed — idempotent; refuses production DSNs.

2

Export env vars

Seed output sets IBEX_DEV_TOKEN, IBEX_DEV_AGENT_ID, IBEX_DEV_ORG_ID.

3

Smoke test

make dev-smoke — validates probes and chat stub with seeded credentials.

Fixed seed IDs: org 00000000-0000-0000-0000-000000000001, agent 00000000-0000-0000-0000-000000000003.

Create via gRPC

CreateToken requires an existing admin bearer with TokenCreate permission.

bash
grpcurl -plaintext \
  -H "authorization: Bearer ibex_pat_<admin-uuid>_<secret>" \
  -d '{"org_id":"<org-uuid>","name":"dev-pat","type":1,"permissions":23}' \
  localhost:9091 ibex.auth.v1.AuthService/CreateToken

The response field plaintext is the only chance to copy the secret. Persist it immediately.

CreateToken parameters

ParameterTypeDescription
org_idRequiredstring (uuid)
Organization that owns the token. Must match caller's org.
nameRequiredstring
Human-readable label for audit and ListTokens.
typeRequiredinteger
Token type enum from proto (1 = standard PAT).
permissionsRequiredint64
Permission bitmap. Use packages/permissions constants in Go.

Revoke a token

Immediate invalidation — no grace period:

bash
grpcurl -plaintext \
  -H "authorization: Bearer ibex_pat_<admin-uuid>_<secret>" \
  -d '{"org_id":"<org-uuid>","token_id":"<token-uuid>"}' \
  localhost:9091 ibex.auth.v1.AuthService/RevokeToken

Revoked tokens return 401 on the next proxy request.

Rotation procedure

1

Issue replacement

CreateToken with the same org and desired permissions.

2

Deploy new secret

Update client env vars or secrets manager entry.

3

Verify traffic

Probe /v1/internal/auth-probe with the new PAT.

4

Revoke old token

RevokeToken on the previous token_id — instant cutover.

Never rotate by deleting rows in Postgres — use the gRPC API so audit and revocation caches stay consistent.

Operator checklist

Production readiness

Before promoting a PAT beyond dev: confirm permissions are minimal, expiry policy is documented, and rotation runbook is assigned.

  • Permissions follow least privilege (ProxyChatCompletion only for LLM clients)
  • Token name identifies the owning service or agent
  • Plaintext stored in vault, not .env committed to git
  • Revocation tested in staging

Related

  • Org and project model — how agents map to orgs
  • Multi-tenant RLS — where hashes are stored
  • Proxy authentication — headers clients send
  • Authentication — fail-closed validation rules

Was this page helpful?

Edit on GitHub

Last updated on

PreviousOverviewNextOrg and project model

On this page

  • PAT wire format
  • Permission bitmap
  • Quick start with seed data
  • Create via gRPC
  • CreateToken parameters
  • Revoke a token
  • Rotation procedure
  • Operator checklist
  • Related
0%