other
Error
- Location
- scripts/run.py:87
- Finding
- Sensitive Medication Records Are Transmitted to an External Model Service<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run.py:15, 21-30, 87-105` **Vulnerability Type**: Sensitive health data disclosure **Risk Level**: High ### Complete Code Snippet ```python API_URL = "https://maas-api.hivoice.cn/v1/chat/completions" MODEL = "u2-med" def _call_llm(system_prompt: str, user_prompt: str, appkey: str) -> str: payload = {"model": MODEL, "temperature": 0.0, "messages": [ {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}]} try: req = Request(API_URL, data=json.dumps(payload, ensure_ascii=False).encode("utf-8"), headers={"Content-Type": "application/json", "Authorization": f"Bearer {appkey}"}) resp = urlopen(req, timeout=120) return json.loads(resp.read().decode("utf-8"))["choices"][0]["message"]["content"] ``` ```python user_prompt = f"""请整理以下用药记录: 总记录数:{len(medications)} 正在服用:{len(active)}种 已停用:{len(stopped)}种 正在服用的药品: ```json {json.dumps(active, ensure_ascii=False, indent=2)} ``` 已停用的药品: ```json {json.dumps(stopped, ensure_ascii=False, indent=2)} ``` 请生成用药管理摘要,分类展示,标注长期/短期用药,给出用药提醒。""" text = _call_llm(SYSTEM_PROMPT, user_prompt, appkey) ``` ### Technical Analysis The application inserts complete medication records into a model prompt and transmits that prompt to `https://maas-api.hivoice.cn/v1/chat/completions`. The transmitted fields can include medication names, doses, frequencies, treatment dates, statuses, and free-form notes. These values constitute sensitive health information, while free-form notes may also contain names, diagnoses, contact information, or other identifying details. The transfer is documented in `SKILL.md`, so it is not covert; however, external inference is mandatory, and the implementation provides no local-only mode, field minimization, pseudonymization, redaction, or technical consent mechanism. The bearer credential is placed in an HTTPS authorization header and is not wri ...[truncated 1140 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Obtain explicit, informed user consent before transmitting any health information. 2. Clearly identify the external processor, data categories sent, purpose, retention policy, jurisdiction, and applicable privacy terms. 3. Add a local-only mode for classification and summary generation where external inference is unnecessary. 4. Minimize the transmitted fields. Do not send free-form notes by default, and omit dates or other identifiers unless essential. 5. Redact or pseudonymize patient identifiers before constructing the request. 6. Add configurable organization-approved endpoints rather than relying exclusively on a fixed external service. 7. Enforce request-size and field-length limits to prevent unintended bulk disclosure. 8. Apply appropriate transport, logging, retention, access-control, and data-processing safeguards at the API provider. 9. Avoid saving unredacted prepared files by default and warn users that `--save-prepared` can create sensitive local artifacts. ]]>
