Files
nick-doc/Issues/ISSUE-101-backend-config-loads-env-development-unconditionally.md
Siavash Sameni dceaf82934 audit: 2026-05-30 full-codebase audit — report, issues, docs, runbooks
Full-codebase-audit 2026-05-30 outputs:
- Audit report: 09 - Audits/Full Codebase Audit - 2026-05-30.md
- 81 issue files ISSUE-055..135 (decisions + 1 skipped no-brainer).
- Scanner docs from scratch (was zero): architecture, data model, API ref, payment
  flow, operations runbook + repo README.
- Doc-sync updates across API reference, data models, flows, design system.
- Secret Rotation Runbook (08 - Operations) for the exposed credentials.
- Reusable workflow guide (07 - Development) + .claude/workflows/full-codebase-audit.js.

Issues remain status:open intentionally — the code fixes are uncommitted-then-committed
working-tree changes per repo and aren't "resolved" until merged/deployed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 18:48:04 +04:00

40 lines
1.4 KiB
Markdown

---
issue: 101
title: "Backend: config loads .env.development unconditionally regardless of NODE_ENV"
severity: medium
domain: Security
labels: [security, backend, configuration]
status: open
created: 2026-05-30
source: Full Codebase Audit 2026-05-30
---
# Backend: config loads .env.development unconditionally regardless of NODE_ENV
**Severity:** medium
**Domain:** Security
**Labels:** security, backend, configuration
## Description
`backend/src/shared/config/index.ts:4` loads `.env.development` unconditionally. In a production environment where `NODE_ENV=production`, this still reads and applies `.env.development` values, overriding injected production secrets with development values. Paired with `.dockerignore` whitelisting this file (ISSUE-075), it means dev secrets are active in prod images.
## Options
1. Load `.env.<NODE_ENV>` conditionally, never fall back to dev file in production.
2. Only load dotenv when not in production (rely on injected env in prod).
3. Load env-specific file and fail fast if required vars are missing.
## Recommendation
Load the env-file matching `NODE_ENV` (or none in production) and never default to `.env.development`. Pair with ISSUE-075.
## Affected Files
- `backend/src/shared/config/index.ts:4`
## References
- [Full Codebase Audit 2026-05-30](../09%20-%20Audits/Full%20Codebase%20Audit%20-%202026-05-30.md) — DEC-49
- [[ISSUE-075-backend-dockerignore-whitelists-env-development-into-prod-image|ISSUE-075]]