Skip to main content
This audit inspects the Express-login-demo repository for secrets-management issues: hard-coded secrets, environment file handling, rotation and revocation capabilities, encryption and password-hashing practices, and startup validations that prevent insecure defaults from reaching production. Below is the exact prompt used to drive the audit assistant (included for traceability and reproducibility):
I’m using a stored prompt rather than typing it repeatedly. You can find these prompts at github.com/JeremyMorgan/claude-code-reviewing-prompts.
A screenshot showing a dark‑mode GitHub repository page titled "Claude‑Code‑Reviewing‑Prompts" with a list of files and repo details. The browser window sits over a code editor/IDE in the background showing a project file tree.
Audit runner (sample output, truncated)
What this audit checks
  • Hard-coded secrets (API keys, DB credentials, JWT secrets, private keys)
  • Proper environment variable usage and ensuring environment files are not committed
  • Secret rotation and token revocation / refresh mechanisms
  • Encryption key management and KDF/salt usage
  • Password hashing configuration (bcrypt rounds)
  • Startup validation to prevent insecure defaults in production
Executive summary (quick risk snapshot)
  • Risk score (example): 7.5 / 10
  • Critical findings: default JWT secret present, .env tracked in repo (no .gitignore), plaintext DB credentials with placeholder values, no token rotation/revocation.
  • Medium findings: bcrypt rounds unspecified or low, no startup validation to block weak dev/test secrets in production.
This report provides concrete file-level evidence and minimal, drop-in remediation snippets where possible. If a referenced file is missing or context is incomplete, the report notes “Unable to verify” and explains what would prove it.
Findings, evidence and remediation (consolidated)
  1. CRITICAL — Default JWT secret present in .env
  • Evidence:
    • .env:2 -> JWT_SECRET=your_jwt_secret_key_here
    • routes/auth.js:53 -> process.env.JWT_SECRET
  • Why it matters: A well-known or short default JWT secret allows attackers to forge tokens, bypass authentication, and escalate privileges.
  • Immediate remediation:
    • Replace the placeholder with a cryptographically secure secret (64+ bytes recommended when hex-encoded).
    • Add startup validation to reject insecure JWT secrets in production.
Example: generate a secure JWT secret
Startup validation snippet (drop-in for server.js or app entrypoint)
  1. CRITICAL — .env file tracked in Git / no .gitignore
  • Evidence: No .gitignore in repo root; .env exists and is tracked.
  • Why it matters: Committed environment files leak credentials when pushed to remote repositories.
  • Immediate remediation:
If secrets were ever pushed to a remote (GitHub, GitLab, etc.), assume compromise: rotate secrets immediately and consider rotating keys stored in third-party services.
  1. CRITICAL — Plain-text database credentials with placeholder values
  • Evidence:
    • .env:9-10 -> DB_USER=your_db_user, DB_PASSWORD=your_db_password
    • config/database.js:4-8 -> configuration reads process.env.DB_USER/process.env.DB_PASSWORD directly
  • Why it matters: Plain-text credentials are high-risk if exposed; placeholder credentials often remain unchanged after cloning.
  • Remediation:
    • Use unique strong credentials for production.
    • For production, store credentials in a secure secrets manager (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault).
    • Add startup validation to reject placeholder DB credentials (see server.js snippet above).
  1. HIGH/MEDIUM — No secret rotation or token revocation capability
  • Evidence: No refresh token implementation, no blacklist/revocation store, and no token versioning detected.
  • Why it matters: Compromised tokens remain valid indefinitely without rotation/revocation.
  • Recommended fixes:
    • Implement refresh tokens and store a revocation list (e.g., token IDs or tokenVersion in user records).
    • Add an admin process to rotate secrets and fallback strategies for key rollover.
    • Document and test rotation procedures.
  1. MEDIUM — Password hashing configuration may be weak or unspecified
  • Evidence: bcrypt used, but salt rounds are not enforced or may be low.
  • Why it matters: Low bcrypt rounds make offline brute-force attacks cheaper.
  • Remediation example (use in user registration and re-hash on login):
  • Consider gradual re-hash on login for existing accounts after increasing rounds.
Proof-of-concept (for education only)
  • Token forgery with a known default secret. Do not run this against systems you do not own.
Or an example curl call against a local test endpoint (example only — do not run against production):
Prioritized remediation plan (short-term → mid-term → long-term) Defense-in-depth recommendations
  • Use a managed secrets service (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault) for production secrets and apply least-privilege IAM.
  • Segregate secrets by environment (dev/staging/prod) and never reuse production credentials in development.
  • Limit DB account privileges and rotate credentials on a schedule.
  • Add monitoring/alerting for suspicious auth behavior (repeated token validation failures, sudden increase in token issuance).
  • Add automated secret scanning into CI/CD to block accidental commits of secrets.
Audit checklist (summary)
  • Scan codebase for hard-coded secrets (API keys, passwords, JWT secrets, encryption keys)
  • Analyze environment variable usage and .env file security
  • Check secret rotation capabilities
  • Examine encryption key management practices
  • Generate structured findings report with severity ratings
  • Create remediation recommendations and risk assessment
Additional resources and references Compliance and business impact
  • Exposed secrets and weak secret management increase the risk of authentication bypass and data breaches, and can cause non-compliance with standards such as PCI-DSS, GDPR, and NIST guidelines. Do not deploy publicly until critical secret issues are remediated and validated.
Closing notes
  • This audit identified clear, actionable problems: default JWT secret, tracked .env, and plaintext DB placeholders. Prioritize rotating any potentially exposed secrets and implementing startup validation to block insecure defaults in production.
  • After applying the immediate remediations, re-run automated scans and add secret scanning to CI to prevent regressions.
Related topic: logging and monitoring — the audit chain continues.

Watch Video