📌 Description
src/config.ts (already improved to fail fast on missing vars) should go further and validate each var's shape (URL format, numeric ranges, allowed enum values) using a schema library, and ensure any error output never echoes secret values verbatim.
🧩 Requirements and context
- Add schema validation (e.g. zod) covering type/format/range for each config value, not just presence.
- On validation failure, list which fields failed and why, without printing secret values (DB URL credentials, API keys) into the error message.
- Add a
redactedConfig() helper safe to log for debugging.
🛠️ Suggested execution
- Introduce a schema in
src/config.ts and validate the parsed env against it at startup.
- Add a redaction helper that masks known-sensitive fields.
- Add tests for a malformed value (wrong type/format) producing a redacted, actionable error.
✅ Acceptance criteria
🔒 Security notes
This directly prevents secret leakage via error messages/logs during misconfiguration, a common accidental-disclosure vector.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
src/config.ts(already improved to fail fast on missing vars) should go further and validate each var's shape (URL format, numeric ranges, allowed enum values) using a schema library, and ensure any error output never echoes secret values verbatim.🧩 Requirements and context
redactedConfig()helper safe to log for debugging.🛠️ Suggested execution
src/config.tsand validate the parsed env against it at startup.✅ Acceptance criteria
redactedConfig()output is safe to log.🔒 Security notes
This directly prevents secret leakage via error messages/logs during misconfiguration, a common accidental-disclosure vector.
📋 Guidelines