Gateway de enforcement de políticas Zero Trust entre clientes y servicios internos.
zerotrust-api es un gateway de autorización que se pone delante de tus servicios internos. Por cada request:
- valida el JWT del cliente (emitido por un IdP en el que confía)
- evalúa políticas por upstream, path, método y rol del tenant
- firma la request hacia el downstream (canonical request + firma)
- reenvía el contexto autenticado ya verificado
Es reutilizable fuera de Sytadel: apuntás VAULT_BASE_URL (o el upstream que quieras proteger) a tu propio servicio, le das un issuer/secreto de JWT, y obtenés enforcement de políticas por tenant + firma S2S anti-replay delante de cualquier API. Incluye un compilador NL → RBAC (Claude emite un PolicySet que un evaluador determinista aplica en runtime).
Es el perímetro obligatorio de la suite: ningún cliente habla directo con vault-api. El gateway valida el JWT de auth-api, resuelve la política del tenant y firma la llamada al vault. Expone vault-api bajo el prefijo /vault.
Client --JWT--> zerotrust-api --signed S2S--> vault-api
|
+-- valida JWT / resuelve directorio --> auth-api
Ver la arquitectura de la suite.
La request se firma con HMAC-SHA256 sobre una representación canónica: método, path, query, hash del body, user id, tenant id, roles, timestamp y nonce. Eso protege contra spoofing de headers, tampering, replay y bypass del gateway.
Roadmap: hay firma asimétrica Ed25519 (
ZT_SIGN_MODE) implementada para reemplazar el HMAC compartido con el vault; HMAC sigue siendo el default en runtime (ZT_ACCEPT_V1_HMAC=true).
El gateway agrega: x-zt-v, x-zt-user-id, x-zt-tenant-id, x-zt-roles, x-zt-ts, x-zt-nonce, x-zt-body-sha256, x-zt-sig.
Las políticas locales viven en local/policies.json (ZT_POLICIES_FILE). Hoy el upstream activo del stack es vault.
yarn install
yarn start:dev # http://localhost:3010Requisitos mínimos:
- un emisor de JWT en el que confiar (
ZT_JWT_ISSUER,ZT_JWT_AUDIENCE,ZT_JWT_HS256_SECRET) - un directorio de identidad para resolver tenants/memberships (
AUTH_DIRECTORY_BASE_URL) — puede serauth-apiu otro compatible - el upstream a proteger (
VAULT_BASE_URL) - PostgreSQL para el store anti-replay
Ejemplo a través del gateway:
curl http://localhost:3010/vault/tenants -H "Authorization: Bearer <ACCESS_TOKEN>"Desde la raíz del meta-repo, docker compose up --build. En la red interna alcanza auth-api en http://auth-api:3001/api y vault-api en http://vault-api:3000; se publica al host en http://localhost:3010.
OWNERsatisface políticas que requieranADMINoMEMBER- el gateway expone
vault-apibajo el prefijo/vault - la firma HMAC y el JWT usan secretos distintos
PolyForm Strict 1.0.0 (source-available, uso no comercial). Ver LICENSE.