Security Vulnerability: Hardcoded Database Credentials in Repository - CWE-798 #216
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.
Security Vulnerability: Hardcoded Database Credentials in Repository - CWE-798
Overview
This PR remediates CWE-798 by implementing the approved secure-secrets design to ensure database credentials are never stored in source control and all services rely on validated runtime configuration.
Issue: #215
Implementation Summary
Phase 1: Clean Up Repository Secrets
.env, expanded.gitignore, and addedapps/hotel-management-service-server/.env.examplewith placeholders so secrets are never stored in git.Phase 2: Harden Configuration Loading & Validation
app.config.ts, wiredConfigModulewith Joi validation, and removed unsafe default fallbacks so the service only uses explicitly supplied secrets.Phase 3: Secrets Manager Override Support
SecretsManagerService, added AWS/GCP SDK integrations, and introducedbootstrapSecretsso remote secrets hydrateprocess.envprior to Nest boot.Phase 4: Secure Local & Containerized Development Flow
.env.local/runtime env vars, ensuring containers never bake in secrets from the deleted.envfile.Phase 5: Secret Rotation & Operational Follow-Up
scripts/rotate-secrets.ts, extended secret service update flows, and introduced an npm script to streamline immediate credential rotation.Testing Commit
Validation Commit
Testing
npm test)Validation
Files Changed
Review Notes
SECRETS_MANAGER_PROVIDERis set appropriately in each environment.npm run rotate-secretsafter deploying to rotate credentials and push values to the active secrets manager.Implementation complete and ready for review.