mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 21:32:18 +00:00
v1.4.43 W13 L-2 — every snapshot builder is allowed to ship arbitrary structured data into the SNAPSHOT JSON that prefixes the Coach userPrompt; free-text fields (medication name, dose unit, note bodies) MUST wrap through `sanitizeForPrompt` first. The audit verified this holds today, but a new snapshot builder added without the import would silently leak control sequences and could override the patient-safety guardrails (e.g. dose-prescription refusal). The guard walks the listed snapshot-builder source files, identifies property-assignment lines whose key matches a free-text field heuristic (`name`, `note`, `description`, `comment`, `drug`, `doseUnit`, `dose`) and whose value expression reads from a user-controlled identifier, then asserts the value path includes `sanitizeForPrompt` — OR the file imports + uses the sanitiser somewhere (consumer-side wrapping, GLP-1-plateau-context pattern). Cheap, deterministic, fires on the canonical 'new builder forgot the sanitiser' failure mode. Adds a sanity check that the heuristic actually trips on a synthetic leak.