Skip to main content

Zero-trust secrets management SDK

Project description

VaultMesh ๐Ÿ”

Zero-trust Secrets Management & Dynamic Credential Rotation Service for Multi-cloud

CI Coverage Python 3.12 License: MIT

VaultMesh is a serverless secrets rotation platform built on AWS Lambda + Step Functions + EventBridge. It automates credential rotation for RDS, Redis, API keys, and JWT signing keys โ€” with zero standing privileges, full audit trails, and no service downtime during rotation.

Architecture

EventBridge Scheduler (cron)
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Step Functions      โ”‚    โ”‚ AWS Secrets Manager                     โ”‚
โ”‚ Rotation Workflow   โ”‚โ”€โ”€โ”€โ–ถโ”‚                                         โ”‚
โ”‚                     โ”‚    โ”‚  AWSCURRENT โ”€โ”€โ†’ AWSPREVIOUS             โ”‚
โ”‚ 1. createSecret     โ”‚    โ”‚  AWSPENDING โ”€โ”€โ†’ AWSCURRENT  (on finish) โ”‚
โ”‚ 2. setSecret        โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚ 3. testSecret       โ”‚              โ”‚ KMS CMK envelope encryption
โ”‚ 4. finishSecret     โ”‚              โ–ผ
โ”‚                     โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ (retry + catch)     โ”‚    โ”‚ Lambda Rotators      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚ - rds_rotator        โ”‚
         โ”‚                 โ”‚ - redis_rotator      โ”‚
         โ”‚ on failure      โ”‚ - api_key_rotator    โ”‚
         โ–ผ                 โ”‚ - jwt_rotator        โ”‚
      SQS DLQ              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
   CloudWatch Alarm โ†’ SNS โ†’ PagerDuty

Rotation Handlers

Secret Type Handler Rotation Mechanism
RDS (MySQL/Postgres) rds_rotator.py ALTER USER via direct DB connection
Redis redis_rotator.py CONFIG SET requirepass via Redis client
API Keys api_key_rotator.py Provider-specific API (GitHub, Stripe, Twilio)
JWT Signing Keys jwt_rotator.py RSA-4096 key pair regeneration, 24h overlap

All handlers follow the 4-step rotation protocol (createSecret โ†’ setSecret โ†’ testSecret โ†’ finishSecret), ensuring old credentials remain valid until the new ones are verified.

Quick Start

git clone https://github.com/KabirMoulana/vaultmesh
cd vaultmesh
pip install -r requirements.txt

# Run tests (no AWS account needed โ€” uses moto mocks)
pytest tests/unit/ -v --cov=src

# Deploy to AWS
npm install -g aws-cdk@2
cdk deploy VaultMeshStack-dev --app "python infra/cdk/app.py"

Zero Standing Privileges

Each Lambda execution role is scoped to exact secret ARN prefixes:

{
  "Effect": "Allow",
  "Action": [
    "secretsmanager:GetSecretValue",
    "secretsmanager:PutSecretValue",
    "secretsmanager:UpdateSecretVersionStage"
  ],
  "Resource": "arn:aws:secretsmanager:us-east-1:123456789:secret:vaultmesh/*"
}

No wildcard * resource permissions anywhere in the codebase.

CI/CD: CDK Diff on PRs

Every pull request gets an automatic CDK diff posted as a comment, showing exactly what infrastructure will change before merge. No surprises in production.

Threat Model

See docs/threat-model/THREAT_MODEL.md for a complete threat analysis including:

  • Attack vectors against the rotation pipeline
  • Data classification for managed secrets
  • Blast radius analysis per compromise scenario
  • Mitigations and compensating controls

This document is intentionally public โ€” security through transparency.

Project Structure

vaultmesh/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ rotators/          # Lambda handlers (one per secret type)
โ”‚   โ”œโ”€โ”€ handlers/          # API Gateway handlers (admin API)
โ”‚   โ”œโ”€โ”€ providers/         # Third-party API clients (GitHub, Stripe)
โ”‚   โ”œโ”€โ”€ models/            # Pydantic models for secret schemas
โ”‚   โ””โ”€โ”€ utils/             # Crypto utilities, audit logger
โ”œโ”€โ”€ infra/cdk/
โ”‚   โ”œโ”€โ”€ app.py             # CDK app entrypoint
โ”‚   โ””โ”€โ”€ stacks/            # CDK stacks (one per concern)
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/              # Moto-based unit tests (no real AWS)
โ”‚   โ””โ”€โ”€ integration/       # Tests against real AWS (staging)
โ””โ”€โ”€ docs/
    โ”œโ”€โ”€ adr/               # Architecture Decision Records
    โ””โ”€โ”€ threat-model/      # STRIDE threat model

Architecture Decision Records

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaultmesh_kabir-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vaultmesh_kabir-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file vaultmesh_kabir-0.1.0.tar.gz.

File metadata

  • Download URL: vaultmesh_kabir-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for vaultmesh_kabir-0.1.0.tar.gz
Algorithm Hash digest
SHA256 872dc041c6ec004dcd218996102a01ffb7fac577fae3db79b959163e937d2dba
MD5 3c86b6cadb00a0f9f1eb83a56fa3940b
BLAKE2b-256 911986a126937a7dc11d3c088e93be739bfb7a1def68ebd89f41bc10be81e062

See more details on using hashes here.

File details

Details for the file vaultmesh_kabir-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vaultmesh_kabir-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20b2688687ac45aac8b8af5b2dabfe5f087d33f0cd0512e73245a40074b92a30
MD5 5eef0b478093c14a98360ab51d0a9e2a
BLAKE2b-256 9708370653b6b9e046dbb51f71021ec5968f5c04f6a8a816d6885f2f85484220

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page