ibexharness
DocsBlogReleasesRoadmap
GitHub
ibexharness

Documentation

OverviewIssuing API keysOrg and project modelMulti-tenant RLS
Auth›Overview
Auth

Overview

The auth service issues API keys and enforces org-scoped access.

The auth service is the identity plane for IBEX Harness. It owns organizations, users, agents, and Personal Access Tokens (PATs) in Postgres, exposes gRPC validation for the proxy on every protected request, and enforces row-level security so one tenant cannot read another's data.

There is no shared session cookie or JWT dashboard flow in Phase 1 — clients authenticate with PATs; the proxy calls auth over gRPC. See Security authentication for the full trust model.

Phase 1 surface

gRPC: ValidateToken, ValidateAgent, CreateToken, RevokeToken, ListTokens. HTTP: /health, /ready, /metrics only — no public REST token API yet.

Service map

Mermaid diagram: flowchart TB
+--------------------+             +--------------------+
|                    |             |                    |
|       Proxy        |             | Operator / grpcurl |
|                    |             |                    |
+--------------------+             +--------------------+
           |                                  |          
         gRPC                                 |          
           |                                  |          
           |                                  |          
           v                                  |          
+--------------------+                        |          
|                    |                        |          
|     Auth :9091     |<-----CreateToken-------+          
|                    |                        |          
+--------------------+                    /metrics       
           |                                  |          
           |                                  |          
           |                                  |          
           |                                  |          
           v                                  v          
+--------------------+             +--------------------+
|                    |             |                    |
| Postgres ibex_core |             |     Prometheus     |
|                    |             |                    |
+--------------------+             +--------------------+

The proxy never connects to Postgres directly in Phase 1 — all identity reads flow through auth. Architecture detail: Services and Data model.

Responsibilities

1

Issue tokens

Hash PAT secrets with Argon2id (ADR-0010); store org-scoped permission bitmaps (ADR-0009). Plaintext shown once at creation.

2

Validate credentials

Answer ValidateToken and ValidateAgent for the proxy middleware chain within a 50ms budget.

3

Isolate tenants

RLS on ibex_core tables plus explicit org_id in every query — defense in depth (ADR-0005).

4

Expose health

Liveness and readiness probes for orchestrators; gRPC TCP check on /ready.

gRPC contract

Package: ibex.auth.v1 (ADR-0006)

RPCCaller authPurpose
ValidateTokenNone (internal)Parse PAT, verify hash, return org_id + permissions
ValidateAgentNone (internal)Confirm agent is active and belongs to org
CreateTokenAdmin PAT with TokenCreateMint new PAT; returns plaintext once
RevokeTokenAdmin PAT with TokenRevokeImmediate invalidation
ListTokensAdmin PATPaginated token metadata (no secrets)

Token validation semantics: ADR-0007.

HTTP endpoints

EndpointPurpose
GET /healthLiveness — {"status":"ok","checks":{}}
GET /readyReadiness — postgres (SELECT 1) + grpc (TCP listen)
GET /metricsPrometheus metrics from packages/metrics

Default ports: HTTP 8081 (IBEX_PORT), gRPC 9091 (IBEX_GRPC_PORT).

Run locally

1

Infrastructure

make compose-dev-up && make db-migrate && make proto-gen

2

Start auth

Set POSTGRES_DSN and run go run ./services/auth/cmd/auth.

3

Verify

curl -s http://localhost:8081/health and grpcurl ValidateToken smoke.

4

Start proxy

Proxy requires auth gRPC before accepting protected traffic.

bash
POSTGRES_DSN=postgres://ibex:ibex@localhost:5432/ibex?sslmode=disable \
  IBEX_GRPC_PORT=9091 go run ./services/auth/cmd/auth

Failure modes

ConditionProxy impactAuth signal
Postgres down503 on protected routes/ready fails postgres check
gRPC port blocked503 SERVICE_DEGRADED/ready fails grpc check
Invalid PAT401 at proxyValidateToken returns unauthenticated

Auth fails closed — there is no cached permission bypass in Phase 1. Phase 2 optional bloom/LRU cache is documented in ADR-0011 §7.

What is not in Phase 1

Honest scope

JWT issuance, OAuth, dashboard login, and HTTP REST token management are not implemented. Operators use gRPC (grpcurl) or seeded dev credentials.

  • User signup and org self-service
  • API key rotation UI
  • Service-to-service mTLS (dev compose uses plaintext on internal network)

Track delivery: current state.

Related guides

  • Issuing API keys — CreateToken and rotation
  • Org and project model — entities and URL binding
  • Multi-tenant RLS — Postgres policies
  • Proxy authentication — how the proxy consumes auth

Was this page helpful?

Edit on GitHub

Last updated on

PreviousProvider adaptersNextIssuing API keys

On this page

  • Service map
  • Responsibilities
  • gRPC contract
  • HTTP endpoints
  • Run locally
  • Failure modes
  • What is not in Phase 1
  • Related guides
0%