Production secrets in dedicated secrets manager
Why it matters
Flat .env files synced to servers are a single point of compromise: one leaked file, one misconfigured S3 bucket, or one server breach exposes every production credential at once. Dedicated secrets managers — AWS Secrets Manager, HashiCorp Vault, Azure Key Vault — provide access control per secret, audit logs of every retrieval, automatic rotation, and versioned history. OWASP A05 (Security Misconfiguration) and NIST SC-12 both require protecting the integrity of keys and credentials throughout their lifecycle. PCI-DSS 4.0 Req-3.5 mandates protecting stored credentials, which flat files cannot satisfy for any cardholder data environment.
Severity rationale
High because flat .env files on servers have no per-secret access control or audit trail, making breach detection and targeted rotation impossible when any one credential is exposed.
Remediation
Replace flat .env.production files with a secrets manager appropriate to your hosting platform. Pull secrets at startup so no plaintext credentials ever land on disk.
AWS Secrets Manager:
import { SecretsManagerClient, GetSecretValueCommand } from '@aws-sdk/client-secrets-manager'
const client = new SecretsManagerClient({ region: 'us-east-1' })
const { SecretString } = await client.send(
new GetSecretValueCommand({ SecretId: 'prod/stripe-key' })
)
HashiCorp Vault:
import vault from 'node-vault'
const client = vault({ endpoint: process.env.VAULT_ADDR, token: process.env.VAULT_TOKEN })
const { data } = await client.read('secret/data/prod/stripe-key')
After migrating, delete the .env.production file from all servers and revoke any credentials it contained.
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-522 — Insufficiently Protected Credentials
- owasp:2021 · A05 — Security Misconfiguration
- nist:rev5 · SC-12 — Cryptographic Key Establishment and Management
- pci-dss:4.0 · Req 3.5 — PAN secured with strong cryptography
- soc2:2017 · CC6.1 — Logical access security software, infrastructure, and architectures
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 (CC6.1) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2