Skip to content

Conversation

@thatkookooguy
Copy link
Member

Description

🚨 Review the guidelines for contributing to this repository. 🚨

Please explain the changes you made here.

You can explain individual changes as a list:

  • feature name: extra details
  • bug: extra details (resolves #issue_number)

Checklist

Please check if your PR fulfills the following requirements:

  • Code compiles correctly (npm run build)
  • Code is linted
  • Created tests which fail without the change (if possible)
  • All relevant tests are passing
    • Server Unit Tests
    • Client Unit Tests
    • Achievements Unit Tests
    • API Tests
    • E2E Tests
  • Extended the README / documentation, if necessary

thatkookooguy and others added 19 commits September 22, 2025 23:45
- Add VaultProvider for Vault client connection and authentication
  - Token, AppRole, and GCP IAM authentication methods
  - Automatic token renewal and expiry tracking
  - TLS enforcement with localhost exception for dev

- Add VaultIntegration for high-level secrets management
  - Background refresh with synchronous cache pattern
  - TTL-based automatic secret refresh scheduling
  - Health monitoring and error tracking

- Add composable decorators for Vault configuration
  - @VaultPath(path) - Vault secret path
  - @VaultEngine(type) - Secrets engine type (kv1, kv2, database, etc.)
  - @vaultkey(key) - Specific key within secret
  - @VaultRefreshBuffer(seconds) - Custom refresh timing
  - @VaultOptional() - Mark secret as optional

- Add local testing infrastructure
  - Docker Compose setup for Vault + PostgreSQL
  - Automated setup script with GCP project creation
  - Cleanup script for GCP resources
  - Comprehensive test suites for all auth methods

- Add security measures
  - Secret masking in logs and errors
  - Path sanitization
  - TLS requirement for non-localhost
- Implement two-phase initialization pattern:
  - Phase 1 (Constructor): Create VaultIntegration instance
  - Phase 2 (initializeVault): Async Vault init + secret loading
  - Phase 3 (Runtime): Synchronous config access

- Add config getter with Vault initialization guard
  - Warns if Vault configured but not initialized
  - Ensures synchronous access after initialization

- Add fallback.required support in initializeVault()
  - required=true (default): Fail fast on Vault errors
  - required=false: Log warning and continue

- Fix critical bug in VaultCache.set()
  - nconf.overrides() now merges instead of replacing
  - Prevents secrets from overwriting each other

- Add 21 new unit tests for Vault integration
  - Backward compatibility tests
  - Source hierarchy tests (Vault > env > file)
  - Error handling tests
  - Initialization flow tests

Test Results: 50 passed, 0 failed
Demonstrates real-world Vault dynamic secret rotation:
- NestJS application with Sequelize PostgreSQL connection
- Database credentials from Vault (60s TTL, auto-refresh)
- Sequelize auto-reconnect on authentication errors
- Query retry after credential rotation

Key features:
- initializeConfigit() runs BEFORE NestJS to ensure credentials are ready
- DatabaseModule wraps Sequelize query to detect auth errors
- Automatic reconnection with fresh credentials from Configit
- Test endpoints to verify rotation works

Files:
- examples/vault-nestjs-sequelize/src/config/*.ts - Configit setup
- examples/vault-nestjs-sequelize/src/database/*.ts - Sequelize with rotation
- examples/vault-nestjs-sequelize/DESIGN.md - Architecture documentation

Usage:
  cd examples/vault-nestjs-sequelize
  npm install
  npm run start:dev
  curl http://localhost:3000/test/db
Comprehensive documentation covering:
- Overview and prerequisites
- Configuration options (IVaultConfigOptions)
- Authentication methods (Token, AppRole, GCP IAM, AWS IAM)
- Fallback chain configuration
- TLS configuration
- Vault decorators (@VaultPath, @VaultEngine, @vaultkey, etc.)
- Usage examples (basic, GCP IAM, dynamic database credentials)
- Source hierarchy (Vault → CLI → Env → Files)
- Health monitoring (getVaultHealth())
- NestJS integration pattern
- Troubleshooting guide
- actions/cache: v2/v3 → v4
- actions/checkout: v2/v3 → v4
- actions/setup-node: v1/v3 → v4

Fixes deprecated action errors in CI pipeline
- Extract release config from package.json to .releaserc.json
- Add @semantic-release/exec for build step
- Remove changelog generation
- Add success comment with release links
Tests requiring a running Vault instance are now properly skipped
unless VAULT_INTEGRATION_TESTS=true is set. This prevents CI failures
while still allowing local testing with a real Vault server.
# [1.0.0-beta.27](v1.0.0-beta.26...v1.0.0-beta.27) (2025-12-21)

### Bug Fixes

* **examples:** remove duplicate type in auth config ([3d3c162](3d3c162))
* **general:** small nits ([f521919](f521919))
* **release:** disable husky on pipelines ([8bab06b](8bab06b))
* **release:** missing steps and remove old bot token ([4e6fd12](4e6fd12))
* **release:** update semantic-release setup ([2ad30f1](2ad30f1))

### Features

* **examples:** add NestJS + Sequelize + Vault example ([1d3b40b](1d3b40b))
* **vault:** add HashiCorp Vault integration ([aa006c3](aa006c3))
* **vault:** integrate VaultIntegration into ConfigService ([6924ae5](6924ae5))
@thatkookooguy thatkookooguy merged commit bff7ca5 into main Dec 21, 2025
6 of 7 checks passed
@thatkookooguy thatkookooguy deleted the release/2025-12-21 branch December 21, 2025 08:21
@github-actions
Copy link

This PR is included in version 2.12.0 🎉

The release is available on:

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.

3 participants