T09 · Insecure Skill Coding Practices
Error
- Location
- references/formulas.json:8
- Finding
- Exact Herbal Dosages and Preparation Instructions Violate the Non-Prescriptive Safety Boundary## Vulnerability Details **File Location**: `references/formulas.json`, lines 8-14; related dosage fields also appear throughout `references/formulas.json` and `references/herbs_db.json` **Vulnerability Type**: Unsafe medical guidance caused by inconsistent configuration and data exposure **Risk Level**: High ### Vulnerable Code Snippet ```json "composition": [ { "herb": "Ren Shen", "dosage": "9g", "role": "Chief", "purpose": "Powerfully tonifies Spleen and Stomach Qi" }, { "herb": "Bai Zhu", "dosage": "9g", "role": "Deputy", "purpose": "Strengthens Spleen, dries dampness" }, { "herb": "Fu Ling", "dosage": "9g", "role": "Assistant", "purpose": "Drains dampness, strengthens Spleen" }, { "herb": "Zhi Gan Cao", "dosage": "6g", "role": "Envoy", "purpose": "Harmonizes, tonifies Qi" } ] ``` Additional actionable dosage and preparation data appears in the herb database: ```json "dosage": "3-9g", "preparation": "Decoction added near end; can be taken as powder" ``` ### Technical Analysis The Skill declares that it must not provide specific medication dosage advice. Its formula response schema and reference datasets nevertheless contain exact quantities, preparation methods, and formula modifications. When the agent fulfills a formula or herb lookup, these fields can be reproduced directly in the response. A disclaimer does not neutralize actionable dosing information. Exact gram quantities, preparation methods, and modification instructions can reasonably be interpreted as instructions for preparing and consuming a medicinal product. The inconsistency between the declared safety boundary and the data model means enforcement depends entirely on the language model electing not to expose fields that the Skill explicitly tells it to use. Confirmed related locations include: - `references/formulas.json:8- ...[truncated 1996 chars]
- Remediation
- ## Remediation Suggestions 1. Remove all user-facing `dosage` and `preparation` fields from the herb and formula datasets. 2. Change the formula output schema so that it lists ingredients and historical roles without quantities. 3. Suppress formula modification instructions that could be used to construct an individualized treatment. 4. Add a deterministic output filter that rejects gram values, dose ranges, frequency instructions, and preparation directions in consumer responses. 5. Do not rely solely on prompt instructions or disclaimers to enforce the restriction. 6. If historical dosages must remain for internal reference, place them in a separately access-controlled professional dataset that this consumer Skill cannot query. 7. Add automated tests covering direct requests, indirect requests, translation requests, and attempts to obtain dosages one ingredient at a time. 8. Require referral to a licensed medical professional whenever a user asks how much of an herb or formula to take.
