The interview problem
Replace a shared database password embedded in thousands of workers with short-lived credentials. Keep jobs running during renewal failures without granting indefinite access.
Original practice, not a reported company interview. All scenarios and worked numbers are illustrative. Interview date: not applicable. Sources retrieved September 30, 2026.
1. Scope and assumptions
Assume workers have a trusted workload identity and the database can enforce credential revocation. Credential leases are authorization lifetimes, not a general distributed lock protocol.
2. Worked approach
workload identity → credential broker → lease + credential → connection pool → renew/revoke
Authenticate the workload to a credential broker, issue least-privilege database credentials and store lease metadata separately from the secret. Deliver credentials through a protected channel and avoid logs. Workers renew before expiry with jitter and switch connection pools to renewed or newly issued credentials.
Define maximum lifetime and a hard failure behavior. Renewal success must be confirmed by the broker; a local timer cannot extend database authority. Track active connections because password expiration may not terminate already authenticated sessions. For urgent revocation, use the database's supported session termination and verify completion. A broker outage triggers bounded degradation, not a static-password fallback.
3. Calculate the example
For 12,000 workers with a 30-minute lease renewed every 20 minutes, average renewal demand is 12,000/1,200 = 10 requests/s. If all workers start together, that average hides a 12,000-request renewal burst. Spread renewals over a five-minute interval to target about 40/s during that interval, then test correlated broker failures. A job lasting 90 minutes cannot rely on a single 30-minute credential unless its access behavior is explicitly supported by renewal or handoff.
4. Failure cases and trade-offs
Secrets in crash dumps survive lease expiry as sensitive material. Renewing the broker lease without refreshing the worker's pool can leave stale connections. Revoking a credential but leaving existing database sessions active may fail the intended access boundary.
Shorter leases reduce exposure but increase renewal dependence. Per-job credentials improve attribution at more issuance cost; per-worker credentials are simpler but broaden the job boundary. Select lifetime from recovery and risk requirements, not a convenient round number alone.
5. Validate the result
Expire credentials mid-job, disable renewal and revoke while sessions are open. Verify the actual database rejects or terminates access as designed. Measure renewal latency, outstanding leases and maximum observed access after revocation.
6. Interview follow-ups and self-review
What happens to queued jobs during a broker outage? How are orphaned leases found?
Reward enforced expiry, identity bootstrapping, connection-session semantics and realistic renewal burst calculations.
Sources and related practice
Technical reference: developer.hashicorp.com — Lease, renewal and revocation concepts; worker/database integration is an original proposal.
Exact publication/update date not established in this review. Retrieved September 30, 2026. This reference supports the named technical concept; the proposed workflow and examples are original, not a documented vendor implementation or interview report.
Continue with Rotate service certificates without interrupting traffic; Revoke access across cached document sessions.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.