Staging uses separate database with test data
Why it matters
A staging environment connected to the production database is not a staging environment — it is a second production environment with weaker access controls. Bugs discovered during staging testing can corrupt, delete, or expose real user data. Developers routinely write aggressive cleanup scripts, run schema migrations, and insert test data in staging, assuming isolation that doesn't exist. NIST SC-7 requires boundary protection between system components. OWASP A05 flags misconfiguration that allows unintended data access. A staging breach that exposes a shared database URL puts the production database password in the attacker's hands.
Severity rationale
Medium because connecting staging to a production database or using production credentials in staging directly risks real user data during routine development and testing operations.
Remediation
Provision a completely separate database for staging with its own credentials, host, and data. Never copy production data to staging — generate synthetic or anonymized test data instead.
# .env.staging
DATABASE_URL=postgresql://user:stagingpass@staging-db.internal/app_staging
# .env.production
DATABASE_URL=postgresql://user:prodpass@prod-db.internal/app_prod
For seeding, use a dedicated script that inserts synthetic records:
npm run db:seed:staging # inserts test users, orders, etc. — no real data
Verify isolation by confirming that the staging DATABASE_URL host does not appear in any production configuration file.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Environment Security Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-668 — Exposure of Resource to Wrong Sphere
- owasp:2021 · A05 — Security Misconfiguration
- nist:rev5 · SC-7 — Boundary Protection
- soc2:2017 · CC8.1 — Change management
Taxons
History
- 2026-04-18·v1.0.0·Initial import from environment-security·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC8.1) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2