Skip to content

feat: add secret rotation service for database credentials and API keys (closes #79) - #124

Merged
JamesEjembi merged 2 commits into
VeriNode-Labs:mainfrom
Kami-no-san:fix/issue-79-secret-rotation-service
Jul 30, 2026
Merged

feat: add secret rotation service for database credentials and API keys (closes #79)#124
JamesEjembi merged 2 commits into
VeriNode-Labs:mainfrom
Kami-no-san:fix/issue-79-secret-rotation-service

Conversation

@Kami-no-san

Copy link
Copy Markdown
Contributor

Summary

Adds src/secret_rotation/mod.rs, a versioned credential store with scheduled expiry, dual-ended grace windows, and atomic rotation.

Changes

  • New: src/secret_rotation/mod.rs (527 lines)
    • Register credentials with configurable TTL and validation
    • Atomic rotation: new credential issued, old deactivated after grace window
    • Overlapping credential versions (up to MAX_ACTIVE_VERSIONS) support in-flight request draining
    • Expiry detection with configurable warning thresholds
    • Automatic purge of expired credentials past the grace window
    • Binding revocation for decommissioned services
    • Comprehensive metrics export for monitoring dashboards
  • Modified: src/lib.rs — added pub mod secret_rotation;

Test Coverage (14 tests)

  • Registration and version tracking
  • Secret length validation (min/max bounds)
  • Rotation lifecycle and active version enforcement
  • Expiry detection and warning thresholds
  • Grace window purge behaviour
  • Multi-binding independence
  • Binding revocation
  • Metrics export

Design

  • Dependency-free (only alloc) for Soroban/WASM compatibility
  • Old credentials remain valid during grace windows for in-flight request safety
  • Credentials never exposed in metrics — only count tracking

Closes #79

…ys (closes VeriNode-Labs#79)

Add src/secret_rotation/mod.rs implementing a versioned credential store
with scheduled expiry, dual-ended grace windows, and atomic rotation:
- Register credentials with configurable TTL and validation
- Atomic rotation: new credential issued, old deactivated after grace window
- Overlapping credential versions support in-flight request draining
- Expiry detection with configurable warning thresholds
- Automatic purge of expired credentials past the grace window
- Comprehensive test suite (14 tests) covering:
  - Registration and version tracking
  - Secret length validation (min/max bounds)
  - Rotation lifecycle and active version enforcement
  - Expiry detection and warning thresholds
  - Grace window purge behaviour
  - Multi-binding independence
  - Binding revocation
  - Metrics export for monitoring dashboards
closes VeriNode-Labs#79)

Both src/config_audit.rs and src/replication/mod.rs already existed but
were never declarated as pub mod in lib.rs, causing unresolved import
errors in tests/config_audit_test.rs and tests/replication_dr_test.rs.
@JamesEjembi
JamesEjembi merged commit 481208c into VeriNode-Labs:main Jul 30, 2026
0 of 2 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.

Secret Rotation Service for Database Credentials and API Keys

2 participants