Why this matters
HIPAA requires traceability of PHI access; robust audit trails support detection and incident response.
For any handler that reads or writes ePHI, write an append-only audit record with user id, patient id, action (READ_PHI/WRITE_PHI), purpose-of-use, timestamp, and request id. Prevent deletion or mutation of audit entries.
HIPAA requires traceability of PHI access; robust audit trails support detection and incident response.
Side-by-side examples engineers can pattern-match during review.
app.get('/patients/:id', async (req,res)=>{ const p=await repo.find(req.params.id); res.json(p); })app.get('/patients/:id', async (req,res)=>{ const p=await repo.findMinimal(req.params.id); await auditLog.write({action:'READ_PHI', user:req.user.sub, patient:req.params.id, pou:req.get('Purpose-Of-Use'), rid:req.id}); res.json(p); })return repo.find(id) // no auditawait auditLog.write({action:'READ_PHI',user:sub,patient:id})From the same buckets as this rule.
Before persisting ePHI, encrypt using a data key protected by a Key Management Service (KMS). Use authenticated encryption (AES-256-GCM or equivalent), rotate keys, and store the key id and algorithm with the record.