[Feature]: Overlapping (dual-key) secret rotation
Self-hosted secrets manager that keeps .env secrets from AI agents
Brought to you by:
dopbase
Originally created by: bosd
For API keys and database credentials, rotating by replacing the single value causes downtime for consumers that have not yet picked up the new value.
Proposal
dopbase secret rotate <key> --grace 24h, with runtime reads returning the current value and an --include-previous option for verification tooling.Out of scope for a first version: provider-specific rotators.
Related to the secret version history proposal in [#33]; the revision storage could be shared.
Originally posted by: thomijasir
[#33] is adding a
secret_versionstable that keeps encrypted versions of each secret. Dual-key rotation could keep its previous slot there instead of adding separate storage.Related
Tickets:
#33Originally posted by: bosd
Agreed that the previous slot belongs in
secret_versionsonce [#33] exists. [#122] stores it as nullableprevious_*columns for now, with each slot keeping its own version and AAD, so moving it into a versions row later is a plain data migration that doesn't re-encrypt anything. The API (previousVersion/previousExpiresAt, rotate/promote) doesn't depend on where the slot is stored. I'd rather not design the versions table inside the rotation PR, so I'll leave a note on [#33] to fold the rotation slot in when it's implemented.Related
Tickets:
#122Tickets:
#33Originally posted by: dopbase
Holding this for now. Before adding a grace period me and @thomijasir need to study how providers handle rotation on their side (AWS IAM, Stripe, database roles), since a grace window in dopbase doesn't revoke anything at the provider.
In the meantime, secret rollback from [#33] covers recovery from a bad rotation, though not overlap. @bosd, thanks for [#122]. I'd like to revisit it on top of secret_versions once the model is clearer.
Related
Tickets:
#122Tickets:
#33Originally posted by: bosd
Makes sense, and agreed on the core point: a grace window in Dopbase only keeps the old value readable, it revokes nothing at the provider. In case it saves some research, how overlap works at the providers you named:
VALID UNTILsets an expiry on the database side, but only for password authentication.In each case the overlap is enforced at the provider. That suggests Dopbase's part is to know which credential is current, when the old one should be revoked, and to prompt or hook that revocation, rather than owning the grace period itself. That would also fit naturally on
secret_versions.I'll mark [#122] as a draft so it stays available when you revisit this.
Related
Tickets:
#122