CareerGPT
Next steps
Resources
High level design
Identity-Backend
- Microservice IAM
- JWT issuer is centralized, consumers delegate all authentication and authorization decisions to identity-backend
- Federated trust
- JWT issuer is centralized, consumers validate locally (no DB calls)
- Claim-based authorization
- Roles/scopes embedded in JWT, no API calls for every check
- Finite State Machine
- Users progress via well defined transitions (guest -> subscriber)
- Single source of truth - Identity service is the only place that knows secrets, roles, and policies. All services trust it’s JWTs
- Modular design - Start with service to service, plug in SSO, RBAC, and etc later without breaking things
- Token-centric security - JWTs as the unit of trust, easily extensible (Claims, scopes, expiration policies)
- Database backed configuration - mvp can use sqllite but schema supports migration to MySQL/PostgreSQL with redesign
- Zero-trust ready - build in mutual validation (issuer, audience, key rotation) even if not enforced day one.
- Boundary and Identity Provider
- Role of the Identity-Backend
- Endpoints
- Fine grained security - subject and audience
- Subject - who the token is about — the entity (service, user, or client) that is being authenticated.
- Audience - who the token is intended for — the target service that will validate and accept the token
- Subject careergpt-backend is being issued a token by identity-backend the idp, to audience logging-service. Meaning this token will be presented to logging-service.
MVP-Design-Iteration-1 - Using one shared secret across all services creates a single point of failure and blocks secure, scalable authentication.
Problem Summary
Core Issue:
We currently use a single static secret for JWT signing and validation across all microservices, meaning if one secret is leaked or rotated, every service is affected. This prevents per-service isolation, token revocation, and proper scaling.
How We Arrived at the +1 Design
-
Recognized Security Gap:
Static secret = no isolation, no rotation, no per-client control. -
Decoupled Trust via Identity Service:
Identity-backend becomes the trust anchor issuing JWTs, while logging-backend (and others) only validate tokens. -
Planned Multi-Secret Architecture (+1 Design):
-
Store key_id → secret_value pairs.
-
Each client/server pair gets its own key_id.
-
JWTs include
kid(key ID), so validation uses the right secret. -
Identity-backend manages all keys centrally (in SQLite for MVP, scalable later).
-
Scalable Benefits:
-
Rotate secrets per service without downtime.
-
Revoke compromised secrets without touching unaffected services.
-
Audit which client issued which token via
kid.
MVP-Service-Secrets-Issue-1 - Current JWT setup uses one shared secret across all services, making rotation, revocation, and client isolation impossible as we scale.
Problem Statement (Summary)
Our current microservice authentication uses a single shared secret (JWT_SECRET_KEY) across identity-backend (issuer) and logging-backend (consumer). While simple, this approach causes major issues as we scale:
-
Single point of failure – If the secret is leaked or rotated, all services break.
-
No client isolation – All clients use the same secret, making it impossible to audit or revoke a single client.
-
No key rotation strategy – Rotating secrets requires redeploying all services simultaneously.
-
Limited flexibility – Cannot issue different secrets per client-service pair.
We need a multi-key, per-client secret management system using kid (key ID) in JWT headers, allowing:
-
Multiple secrets stored in a central DB (managed by
identity-backend). -
Per-client secrets and isolated key rotation.
-
Backward compatibility during transitions (old keys remain valid until expiry).
Why Use Multiple Shared Secrets
-
-
If one service’s secret leaks, only that service’s communications are compromised.
-
Other services remain secure without needing global rotation.
-
-
-
You can revoke a single client/service’s secret without affecting the others.
-
-
-
Easier to trace requests to a specific client (by
subclaim) and validate using that client’s secret.
-
-
Future Scalability
-
As you add more microservices (e.g.,
careergpt-backend,analytics-backend), you won’t have to share a single global secret across all.
-
CareerGPT-Backend
API Gateway, enforces policy
Validates JWTs before routing to microservices
Applies rate limiting, logging, anomaly detection
Comments
Post a Comment