Secret rotation service for database#112
Open
gloskull wants to merge 2 commits into
Open
Conversation
Add secret rotation service for database credentials and API keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Provide a deterministic, metadata-only coordinator to rotate database credentials and API keys with safe exportable metadata and zero-downtime rollout semantics.
Define a provider abstraction so production integrations can implement KMS/secret-manager creation and retirement without exposing secret material.
Ship operational artifacts (runbook, alerts, dashboard) to ensure safe blue-green/canary rollouts and on-call guidance.
Description
Add a Rust library src/secret_rotation.rs implementing SecretKind, RotationPolicy, SecretRecord, RolloutPlan, the SecretProvider trait, and an in-memory SecretRotationService with evaluate and rotate_due decision/coordination logic.
Add unit tests covering due rotations, non-due evaluations, previous-version retirement tracking, and invalid policy rejection in src/secret_rotation.rs (tests run under #[cfg(test)]).
Expose the module via src/lib.rs and enable chrono serde support in Cargo.toml so DateTime and Duration can be serialized for safe metadata export.
Add documentation and operational artifacts: docs/SECRET_ROTATION_ARCHITECTURE.md, docs/runbooks/SECRET_ROTATION_RUNBOOK.md, monitoring/secret-rotation-alerts.yml, and monitoring/secret-rotation-dashboard.json to scaffold monitoring and runbook procedures.
Testing
Ran formatting check with cargo fmt --all -- --check, which completed successfully.
Ran cargo test, which executed the module tests (3 unit tests) and reported 3 passed; 0 failed.
Ran cargo clippy --all-targets --all-features -- -D warnings, which completed without warnings.
Closes #78