Skip to content

feat(rotation): add secret rotation service with automated key swap runbook (Closes #2275) - #2310

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2275-secret-rotation
Nov 24, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2275-secret-rotation

Conversation

@IVANLI2412

Copy link
Copy Markdown
Contributor

Summary

Closes #2275.

Adds a production-ready secret rotation service with automated key swap and a comprehensive runbook for all integrated providers.

What changed

  • backend/src/services/rotation.ts — SecretRotationService orchestrating the full rotation lifecycle:

    • PENDING → GENERATING → VALIDATING → PROMOTING → DEPRECATING → COMPLETED
    • Automatic rollback on any failure after promoting phase
    • Approval gates (requireApproval), grace periods, rotation windows
    • Configurable policies per provider/secret type (interval, max age, grace period)
    • Pluggable interfaces: SecretStore, SecretGenerator, SecretValidator, SecretPromoter
    • Full observability: structured logging, Prometheus-style metrics, tracing
    • rotateNow() for emergency manual rotations (skips approval/grace period)
  • ops/runbooks/secret-rotation.md — Complete operational runbook:

    • Provider-specific procedures for Stripe, PayPal, GitHub, OpenAI, Anthropic, Slack, SendGrid, Twilio, AWS, GCP, Azure
    • Secret types: api_key, webhook_secret, client_secret, private_key, certificate, oauth_token
    • Step-by-step procedures: scheduled, manual, approved, emergency rotations
    • Monitoring: key metrics (subtrackr.rotation.*), Grafana dashboard, alerting rules
    • Failure scenarios & recovery: generation/validation/promotion failures, rollback, approval timeout
    • Manual rollback procedure, security considerations
  • backend/src/services/__tests__/rotation.test.ts — 20 unit tests covering:

    • Job creation, approval, filtering
    • Full pipeline execution (success, validation failure, promotion failure)
    • Rollback on promotion failure
    • Emergency rotateNow() (skips approval/grace period)
    • Error codes and default policy

Verification

  • 20/20 unit tests pass via Node 26 type-stripping harness (no npm install)
  • Core module exports validated: DEFAULT_POLICY, RotationError, RotationErrorCode

Payout details

  • Base Mainnet USDC: 0xC5dD2Ea54FF138bb3f71D3466092eA31eF115868
  • Solana: DN3pfYEvdkoTBP4oaEVvemsr98fZPhDSAbfVfmewRGQ5
  • PayPal: ivanzenteno3@gmail.com

…unbook (Closes Smartdevs17#2275)

Adds backend/src/services/rotation.ts with SecretRotationService orchestrating full rotation lifecycle (generate → validate → promote → deprecate) with approval gates, grace periods, and rollback. Includes ops/runbooks/secret-rotation.md with provider-specific procedures (Stripe, PayPal, GitHub, OpenAI, Anthropic, Slack, SendGrid, Twilio, AWS/GCP/Azure) and monitoring/alerting. Adds 20 unit tests in backend/src/services/__tests__/rotation.test.ts. Closes Smartdevs17#2275
@github-actions
github-actions Bot merged commit c243f25 into Smartdevs17:main Nov 24, 2026
4 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add provider secret rotation runbook with automated key swap

1 participant