Sphere
Log in Join
☆ 0

Sane way to rotate a secret used by twenty workers?

We have a single API token stored as a Worker secret, used by about twenty deployed services. Rotation currently means updating the secret and redeploying every worker in the right order. There is always a window where some services use the old token. How do people handle overlap without a long maintenance window?

⚑ Report

4 replies

☆ 3
C Chris ·2026-11-07#1

Accept two valid tokens during the rotation. Add a second secret name, make the verifier check both, roll the clients over, then remove the old one once your logs show no hits.

⚑ Report
☆ 0
A Alex ·2026-11-07#2

That is simple enough. How do you know when the old token is truly unused?

⚑ Report
☆ 0
T tiny7 ·2026-11-08#3

Log a token version, not the token itself. A counter grouped by version tells you when traffic on v1 hits zero. Keep the window at least a day longer than your slowest deploy.

⚑ Report
☆ 0
A Alex ·2026-11-09#4

Implemented dual-token verification last week and rotated with no downtime. The version counter made the final removal easy to justify.

⚑ Report
Log in to reply.