pediatric-ai-scribe-v3/src/routes
Daniel 250646110f fix(security): timing-safe forgot-password + redact log file writer
Two independent PHI-leak hardenings folded together:

1. forgot-password timing oracle
   The hit path previously did SELECT + token gen + UPDATE + SMTP send
   before responding; the miss path returned after the SELECT. An
   attacker could distinguish registered emails by response latency
   (SMTP RTT is hundreds of ms). Response is now sent immediately after
   Turnstile, with the DB and email work fired-and-forgotten in a
   background async block. Hit and miss take identical wall-clock time.

   Also hardened req.body.email to tolerate missing/non-string input
   instead of throwing 500.

2. logger.file redaction
   logger.info/warn/error wrote straight to /app/data/logs/YYYY-MM-DD.log
   without going through redact(). Current callers are metadata-only and
   safe, but any future caller writing logger.error('boom', req.body)
   would silently drop PHI to disk. Route both message and optional data
   through redact() — same helper the audit path already uses. Benign
   startup messages pass through unchanged; SSN/phone/email/DOB patterns
   are tokenised, long note-body-shaped text is truncated.
2026-04-22 01:01:00 +02:00
..
admin.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
adminConfig.js fix: auth/API logging to Loki, TTS voice auto-detection, STT ElevenLabs support 2026-04-19 21:26:49 +02:00
adminMilestones.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
audioBackups.js Security hardening: PHI encryption, argon2, DOMPurify, SRI 2026-04-14 02:49:38 +02:00
auth.js fix(security): timing-safe forgot-password + redact log file writer 2026-04-22 01:01:00 +02:00
billing.js Batch of security + scale fixes 2026-04-14 05:24:40 +02:00
chartReview.js Prompt-injection wrap: remaining AI routes 2026-04-14 05:31:54 +02:00
documents.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
encounters.js feat(security): AES-256-GCM at-rest encryption for encounters and memories 2026-04-22 01:01:00 +02:00
hospitalCourse.js Prompt-injection wrap: remaining AI routes 2026-04-14 05:31:54 +02:00
hpi.js Batch of security + scale fixes 2026-04-14 05:24:40 +02:00
learningAdmin.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
learningAI.js feat: neonatal calculator, DOCX/PPTX/ODT/EPUB support, gateway-agnostic URL helper, TTS/STT fixes 2026-04-19 02:17:06 +02:00
learningHub.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
logs.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
memories.js feat(security): AES-256-GCM at-rest encryption for encounters and memories 2026-04-22 01:01:00 +02:00
milestones.js Prompt-injection wrap: remaining AI routes 2026-04-14 05:31:54 +02:00
nextcloud.js Security hardening: PHI encryption, argon2, DOMPurify, SRI 2026-04-14 02:49:38 +02:00
oidc.js Fix local-auth sections not showing for normal users + backup-code modal signature 2026-04-14 04:43:07 +02:00
refine.js Batch of security + scale fixes 2026-04-14 05:24:40 +02:00
sessions.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
sickVisit.js Prompt-injection wrap: remaining AI routes 2026-04-14 05:31:54 +02:00
soap.js Batch of security + scale fixes 2026-04-14 05:24:40 +02:00
transcribe.js fix: auth/API logging to Loki, TTS voice auto-detection, STT ElevenLabs support 2026-04-19 21:26:49 +02:00
tts.js fix: auth/API logging to Loki, TTS voice auto-detection, STT ElevenLabs support 2026-04-19 21:26:49 +02:00
userPreferences.js Stop leaking e.message to clients across all routes 2026-04-14 03:04:24 +02:00
wellVisit.js Prompt-injection wrap: remaining AI routes 2026-04-14 05:31:54 +02:00