ADR-0003: Platform IAM, Authentication, STS, and Pluggable SSO Seam (stravin-auth)¶
- Status: Proposed
- Date: 2026-11-26
- Scope: Platform identity, authentication, Security Token Service (STS), coarse org/repo RBAC, Valkey
jtirevocation, and pluggable enterprise SSO & directory sync (OIDC,SCIM 2.0, optionalWorkOSadapter, futureSAML 2.0) across Stravin Core, Stravin Review, Stravin Run, Stravin Index, Stravin Gate, Stravin Webhooks, and Stravin Notify.
Context¶
stravin-dev/core (v1.12.x) currently authenticates Git Smart HTTP and SSH clients via edge.StaticAuthenticator (static tenant_id:actor_id:token credentials and SSH authorized_keys). Across the upper platform:
- ADR-0001 established Cilium (eBPF) transparent WireGuard/SPIFFE mTLS for pod-to-pod workload identity (explicitly NOT user or tenant RBAC), NATS JetStream for internal async events, Stravin Webhooks (
stravin-webhooks) for outbound customer HTTP delivery, and Temporal for Run and Gate workflows. - ADR-0002 introduced an External OIDC App Control Plane, an SSRF-hardened IAM/STS egress proxy for dynamic IdP JWKS fetches, short-lived
commit_oid-pinnedgit:readtokens (TTL <= 120s), and a Valkeyjtideny-list atstravin-edge.
As Stravin scales from local Docker Compose and single-tenant self-hosted deployments to multi-tenant SaaS and enterprise SSO environments, four architectural requirements must be settled in one foundation service:
- Zero-External-IdP Standalone Operation: Local development, open-source self-hosting, and small teams must work out of the box without deploying or operating Keycloak, Dex, Okta, or Entra ID.
- Enterprise SSO Without Polluting Product Services: Enterprise tenants require OIDC SSO, SCIM 2.0 automated provisioning/deprovisioning, and eventually SAML 2.0. Downstream products (
Core,Review,Run,Index,Gate,Webhooks,Notify) must contain zero IdP-specific protocol code. - Zero Synchronous Auth Tax on the Git Hot Path: Calling an auth service synchronously on every
git push,git fetch, or internal RPC would add tail latency, create a single point of failure, and jeopardize Core's throughput SLOs. - Fast Deprovisioning & Account-Takeover Prevention: When an enterprise admin deactivates a user via SCIM 2.0 or downgrades their role, active sessions, PATs, and Git tokens must be invalidated within seconds, and SSO logins must never be exploitable to hijack unverified local accounts.
Decision¶
We introduce stravin-auth (Stravin Auth) as the dedicated, Temporal-free Platform IAM, Authentication, and STS service with four architectural pillars:
- Standalone First (Zero External IdP Required)
- Two Pluggable Enterprise Seams (
IdentityProviderfor Login +DirectorySyncAdapterfor Provisioning/Deprovisioning, including Optional WorkOS Adapter) - Strictly Off the Synchronous Hot Path (Local JWKS + Valkey
jtiDeny-List) - Mandatory Security Hardening Invariants & Local Dev Parity
flowchart TB
subgraph ExternalIdPs["External Enterprise IdPs & Directory Sync (Optional Add-On)"]
OIDCIdP["Phase 1: Native OIDC IdP\n(Auth Code + PKCE, Pinned Issuer)"]
WorkOSSSO["Optional: WorkOS SSO Broker\n(workos.com, Managed SaaS)"]
SAMLIdP["Future: Native SAML 2.0 IdP\n(XML Signature ACS)"]
SCIMClient["Phase 1: Native SCIM 2.0\n(/scim/v2/Users, /scim/v2/Groups)"]
WorkOSDirSync["Optional: WorkOS Directory Sync\n(Signed dsync.user.* / dsync.group.* Webhooks)"]
end
subgraph AuthService["Stravin Auth (stravin-auth) — Sole Token Issuer [Temporal-Free]"]
direction TB
Standalone["Standalone Auth Store\n(Passkeys/WebAuthn, Argon2id,\nSSH Keys, PATs, Coarse Org/Repo RBAC)"]
IdPSeam["IdentityProvider Seam\nCanonical Assertion:\n(tenant_id, idp_id, external_sub,\nemail, email_verified, groups)"]
DirSyncSeam["DirectorySyncAdapter Seam\nNormalized Pipeline:\n(UpsertUser, DeactivateUser,\nSyncGroup, RemoveGroupMember)"]
OIDCApps["External OIDC Apps & STS\n(ADR-0002 App Registrations,\nSole Service/User/Git JWT Minter)"]
SafeDialer["SSRF-Hardened Egress Dialer\n(Discovery / JWKS / Broker API)"]
IdPSeam --> OIDCApps
DirSyncSeam --> Standalone
DirSyncSeam --> OIDCApps
Standalone --> OIDCApps
IdPSeam -.-> SafeDialer
end
Valkey["Valkey\n(jti Revocation Deny-List\n+ SSH Key Cache)"]
NATS["NATS JetStream\n(STRAVIN_AUTH: stravin.auth.>)"]
subgraph HotPath["Hot-Path & Product Services (Cilium eBPF SPIFFE mTLS)"]
Edge["stravin-edge\n(Local JWKS + Valkey jti Check,\nZero Sync Auth RPCs)"]
Node["stravin-node\n(Tier 1 Wasm Hooks)"]
Products["Review / Run / Index / Gate\nWebhooks / Notify\n(Local JWKS + App tenant_id AuthZ)"]
Edge <--> Node
end
OIDCIdP -->|"Auth Code + PKCE"| IdPSeam
WorkOSSSO -.->|"Optional Broker Adapter"| IdPSeam
SAMLIdP -.->|"Same Seam (Future)"| IdPSeam
SCIMClient -->|"Scoped Bearer Token"| DirSyncSeam
WorkOSDirSync -.->|"HMAC-Signed Webhook"| DirSyncSeam
SafeDialer -.->|"Safe HTTPS (No Private CIDRs)"| OIDCIdP
SafeDialer -.->|"Safe HTTPS"| WorkOSSSO
OIDCApps -->|"Push Revoked jti"| Valkey
OIDCApps -->|"Publish principal.revoked / role_changed / security.alert"| NATS
OIDCApps -.->|"Cached JWKS (/.well-known/jwks.json)"| Edge
OIDCApps -.->|"Cached JWKS (/.well-known/jwks.json)"| Products
Edge -->|"Sub-ms jti Check"| Valkey
NATS -->|"Revocation & Alert Events"| Edge
NATS -->|"Revocation & Alert Events"| Products
1. Standalone First (Zero External IdP Required)¶
stravin-auth ships with a complete built-in identity store and STS so single-tenant, self-hosted, and local Docker Compose environments require zero external identity infrastructure:
- Local Human Accounts: Passkeys / WebAuthn (primary) and Argon2id password hashing with MFA support.
- SSH Public Keys: User-managed SSH key registration (
ed25519,ecdsa,rsawith minimum key-strength policy) served tostravin-edgevia cached fingerprint resolution. - Personal Access Tokens (PATs): Fine-grained, tenant- and repo-scoped tokens (prefix
stv_pat_, SHA-256 hashed at rest, explicit expiration, instant revocation). - OIDC Apps & Installations (per ADR-0002): App registration, tenant installation, OIDC workload identity exchange, and pool-scoped runner claims.
- STS Token Minting: Issues signed Ed25519/ES256 JWTs for internal services (
exp <= 5m), user web/API sessions, andstravin-edgescoped Git tokens (commit_oid-pinnedgit:readTTL <= 120s,git:bundle:read, and protectedgit:writewith narrowref_globs). - Valkey
jtiRevocation Deny-List: Shared low-latency revocation store keyed by(tenant_id, jti)with TTL matching the token's remaining lifetime. - Coarse Org/Repo RBAC: Authoritative mapping of
(principal, tenant_id, repo_id, role/scopes)across canonical roles (owner,admin,maintainer,write,read) and fine-grained scopes.
2. Pluggable Enterprise Seams (IdentityProvider + DirectorySyncAdapter)¶
All external enterprise identity and provisioning protocols plug behind two internal adapter seams inside stravin-auth. Because every downstream product (Core, Review, Run, Index, Gate, Webhooks, Notify) consumes only stravin-auth-minted JWTs and STRAVIN_AUTH JetStream events, zero IdP- or broker-specific code exists outside stravin-auth:
2.1 IdentityProvider Seam (Login)¶
Every login adapter normalizes its protocol-specific assertion into one canonical struct:
ExternalIdentityAssertion {
tenant_id: string // Immutable tenant binding
idp_id: string // Registered IdP configuration ID (idp_<ulid>)
external_sub: string // Immutable IdP subject identifier (never mutable email)
email: string // Normalized lowercase email address
email_verified: bool // Explicitly asserted by the IdP
groups: []string // IdP group identifiers for deterministic role mapping
}
- Phase 1 — Native
oidc: Authorization Code flow with PKCE (S256), strictstateandnoncebinding, pinned issuer URL (iss), and an SSRF-hardened discovery/JWKS HTTP client enforcing the same private-CIDR, loopback, link-local (169.254.169.254), and DNS-rebinding blocks defined in ADR-0002. - Optional —
workosBroker Adapter (workos.com): Managed SaaS deployments may enable an optional WorkOS SSO adapter behindIdentityProviderto accelerate multi-IdP enterprise onboarding (Okta, Entra ID, Google Workspace, SAML/OIDC) without building per-IdP edge-case parsers on day one. The adapter exchanges the WorkOS authorization code for the user profile and emits the identicalExternalIdentityAssertion. - Future — Native
saml: Plugs into the exact sameIdentityProviderseam: Assertion Consumer Service (ACS) validates XML signatures against the tenant's pinned IdP X.509 certificate, enforces assertion ID replay protection, and emits the identicalExternalIdentityAssertion-> same JWT minting pipeline, with zero downstream product changes.
2.2 DirectorySyncAdapter Seam (Provisioning & Deprovisioning)¶
Every external directory sync source plugs behind DirectorySyncAdapter and normalizes incoming mutations into the exact same internal provisioning pipeline (UpsertUser, DeactivateUser, SyncGroup, RemoveGroupMember):
- Native SCIM 2.0 (Phase 1):
/scim/v2/Usersand/scim/v2/Groupsendpoints authenticated by a per-tenant scoped bearer token (hashed at rest, rotatable), driving deterministic group-to-role mapping and instant user deprovisioning. - Optional WorkOS Directory Sync (
workos.com): Signeddsync.user.*anddsync.group.*webhook ingestion (POST /v1/auth/dsync/workos/webhooks) verified via HMAC-SHA256 signature and timestamp replay window checks. - Identical Downstream Pipeline: Both native SCIM 2.0 and WorkOS Directory Sync feed the exact same internal
UpsertUser/DeactivateUser/SyncGroup/RemoveGroupMemberhandlers, which synchronously revoke active sessions, write Valkeyjtideny-list /rev_epochentries, and publishSTRAVIN_AUTHJetStreamprincipal.revokedandprincipal.role_changedevents.
2.3 Zero Vendor Lock-In / Sole Token Issuer Invariant¶
stravin-authIs the Sole Token Issuer:stravin-authremains the exclusive owner of/.well-known/jwks.json, internal service JWTs,commit_oid-pinned Git tokens, PATs, SSH keys, OIDC Apps, Valkeyjtideny-lists, and coarse org/repo RBAC. WorkOS NEVER mints tokens accepted by Core, Review, Run, Index, Gate, Webhooks, or Notify.- Zero SaaS Dependency for Self-Hosted & Local Dev: Self-hosted and local Docker Compose environments run standalone or native OIDC + SCIM 2.0 with zero WorkOS account, SDK runtime requirement, or outbound SaaS dependency.
- Lossless Adapter Swapping: Swapping a tenant between WorkOS and native OIDC/SAML + SCIM 2.0 updates only the tenant's
IdentityProvider/DirectorySyncAdapterconfiguration insidestravin-auth, preservingprincipal_idand all RBAC bindings without touching any downstream product.
3. Strictly Off the Synchronous Hot Path (Critical Invariant)¶
- Zero Sync Auth RPCs on Git Traffic:
stravin-authis NEVER called synchronously on everygit push,git fetch, or hot-path product RPC. - Local JWKS Verification + Valkey
jtiCheck:stravin-edge, Review, Run, Index, Gate, Notify, and Webhooks verifystravin-authJWT signatures locally in-process using cached JWKS (/.well-known/jwks.json, refreshed proactively onjwks.rotatedevents and periodic TTL) paired with sub-millisecond Valkeyjtideny-list checks for revocable tokens. - Domain Policies Stay in Owning Products:
stravin-authowns coarse org/repo RBAC ((principal, tenant_id, repo_id, role/scopes)), NOT product-specific business rules:stravin-node(Core): Continues to own synchronous Tier 1wazeroWasmpre-receive/updatehooks (HookHostABI).Stravin Gate: Continues to own branch protection,CODEOWNERS,policy_version, and merge-queue eligibility.Stravin Run: Continues to ownrunner_poolisolation (untrusted-prvs.protected/gate) and active-lease checks.
- Cilium eBPF Boundary Unchanged: Cilium continues to own pod-to-pod WireGuard/SPIFFE mTLS workload identity and
CiliumNetworkPolicyallowlists—never user or tenant RBAC.
4. Security Hardening Invariants¶
- No Auto-Linking to Unverified Emails (Account Takeover Prevention):
stravin-authMUST NEVER automatically link an incomingExternalIdentityAssertionto an existing local account solely by matchingemailwhenemail_verifiedisfalseor when the local account's email is unverified.- Linking an SSO identity to a pre-existing local account requires either an existing
(tenant_id, idp_id, external_sub)binding or an explicit authenticated account-linking flow where the user proves control of both identities.
- Instant Directory Sync Deprovisioning & Revocation Propagation:
- On any
DirectorySyncAdapterDeactivateUserevent—whether native SCIM (active: falseorDELETE /scim/v2/Users/{id}) or WorkOS Directory Sync (dsync.user.deleted)—as well as admin suspension or role downgrade,stravin-authMUST synchronously:- Revoke all active web sessions and mark the principal suspended (blocking all PAT and SSH key resolution).
- Push all active revocable
jtivalues (or principal revocation epoch) into the Valkeyjtideny-list. - Publish
stravin.auth.<tenant_id>.principal.revoked(orprincipal.role_changed) onto NATS JetStream (STRAVIN_AUTH) sostravin-edge, Review, Run, Index, Gate, Webhooks, and Notify drop cached permissions and active streams within seconds.
- On any
- SSRF-Hardened Egress Isolation:
stravin-authformally owns the SSRF-hardened IAM/STS egress proxy role introduced in ADR-0002. Outbound OIDC discovery and JWKS fetches use a custom safe dialer rejecting private, loopback, link-local (169.254.169.254), and multicast CIDRs on resolved socket IPs under a dedicated egressCiliumNetworkPolicy.
- Mandatory Constant-Time
tenant_idIsolation:- Every IdP config, SCIM bearer token, PAT, SSH key, RBAC binding, and minted JWT is strictly bound to
tenant_idand verified in constant time.
- Every IdP config, SCIM bearer token, PAT, SSH key, RBAC binding, and minted JWT is strictly bound to
- Local Development Parity:
- Docker Compose runs a single
stravin-authcontainer in standalone mode out of the box (pre-seeded with dev accounts, PATs, SSH keys, and/.well-known/jwks.json). - An optional Docker Compose profile (
--profile sso) boots a local mock OIDC/SCIM provider so enterprise SSO login, group-to-role mapping, and SCIM instant deprovisioning are tested locally without external cloud dependencies.
- Docker Compose runs a single
Alternatives Considered¶
| Alternative | Summary | Why Rejected |
|---|---|---|
| Require Keycloak or Dex for all deployments | Bundle an external Java/Go IdP as a mandatory dependency even for local dev and single-tenant self-hosting. | Heavy operational and memory footprint in Docker Compose; still requires custom Stravin code for SSH keys, fine-grained PATs, commit_oid-pinned Git STS tokens, Valkey jti deny-lists, and coarse repo RBAC. |
Synchronous auth sidecar / ext_authz on every request |
Call stravin-auth synchronously on every stravin-edge Git push/fetch and internal product RPC. |
Adds network latency and a hard availability dependency to Core's 256 MiB Git hot path; unnecessary when Ed25519/ES256 JWKS verification + Valkey jti checks execute locally in sub-millisecond time. |
| Embed OIDC/SAML/SCIM directly into Review or Core | Put user login and enterprise SSO inside Review, and keep separate static auth in Core. | Splits identity truth across products, forces duplicated token minting and revocation logic, and leaks IdP protocol parsing into domain services. |
| Push user/tenant RBAC into Cilium eBPF | Encode tenant or user permissions into Cilium identities and CiliumNetworkPolicy rules. |
Violates Cilium's workload-identity boundary (ADR-0001), explodes eBPF policy cardinality per user/repo, and cannot express Git-ref or PR-level tenancy. |
| Make WorkOS mandatory / use WorkOS as token issuer | Require WorkOS for all deployments and have downstream services verify WorkOS-issued tokens directly. | Breaks air-gapped, self-hosted, and local Docker Compose parity; couples Core Git and internal service hot paths to a third-party SaaS issuer instead of stravin-auth JWKS, commit_oid-pinned Git STS tokens, and Valkey jti revocation. |
Consequences¶
Positive¶
- Zero-friction standalone & local dev: Developers and self-hosters get full auth (passkeys, Argon2id, SSH keys, PATs, OIDC Apps, RBAC) with one lightweight container and zero external IdP setup.
- Enterprise-ready without downstream churn: Adding OIDC + SCIM 2.0 (Phase 1) and SAML 2.0 (Future) behind
IdentityProviderrequires zero changes in Core, Review, Run, Index, Gate, Webhooks, or Notify. - Hot-path resilience:
stravin-edgeand all product services continue validating tokens via cached JWKS even ifstravin-authrestarts briefly. - Unified ADR-0002 ownership: Consolidates the external OIDC App control plane, SSRF-hardened JWKS egress proxy, and Valkey
jtideny-list into one dedicated, Temporal-free service.
Negative / Trade-offs¶
- Eventual consistency window on non-revoked JWTs: Short-lived JWTs (
exp <= 5m, Git tokens<= 120s) remain valid until expiry unless explicitly checked against the Valkeyjtideny-list or principal revocation epoch. High-sensitivity actions (git:write, admin mutations, notification dispatch) must check Valkey /stravin-authrather than relying solely on JWT expiry. - Shared Valkey dependency for instant revocation: Instant
< 5sSCIM revocation acrossstravin-edgeand upper products depends on Valkey availability andSTRAVIN_AUTHJetStream delivery; degraded Valkey behavior must fail closed for writes and admin actions.
Undo / Rollback Path¶
- Disable Enterprise SSO Add-On: Removing or disabling tenant
IdentityProviderandDirectorySyncAdapterconfigs reverts a tenant cleanly to standalone local accounts, SSH keys, and PATs with zero schema or downstream wire breakage. - Swap External IdP or Directory Sync Adapter: Because
stravin-authis the sole token issuer and downstream services only verifystravin-authJWTs, migrating a tenant between WorkOS and native OIDC/SAML + SCIM 2.0 requires updating only the tenant'sIdentityProvider/DirectorySyncAdapterrecords while preservingprincipal_idand RBAC bindings. - Fallback in Core
v1.12.x:stravin-edgeretainsedge.StaticAuthenticatorbehind its authenticator interface during thev1.12.x->vNexttransition.
Related Documents¶
- Platform Products ⟷ Stravin Auth Interface — Full meet-in-the-middle contract, STS/JWKS/SCIM APIs,
STRAVIN_AUTHJetStream events, and contract-test fixtures. - Platform Events ⟷ Stravin Notify Interface — Consumes
stravin-authRBAC visibility checks andSTRAVIN_AUTHsecurity/revocation events. - ADR-0001: Platform Transport, Internal Events, External Webhooks, and Durable Workflows — Cilium eBPF mesh, NATS JetStream,
stravin-webhooks, and Temporal boundaries. - ADR-0002: External Runner Seam, State-Machine Ownership, and OIDC App Authentication — External OIDC Apps,
commit_oid-pinned Git tokens, Valkeyjtideny-list, and SSRF-hardened JWKS egress. - Product-Stack Interface Overview & Matrix — System-wide topology, canonical identifiers, and shared auth conventions.