T09 · Insecure Skill Coding Practices
- Location
scripts/run.py:87- Finding
Configurable API Endpoint Can Expose the Bearer Credential and Sensitive Medical Data
- Content
View full analysis
str: payload = { "model": model, "temperature": temperature, "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=timeout) ``` The destination is directly configurable through a command-line argument: ```python p.add_argument("--api-url", default=DEFAULT_API_URL, help="OpenAI 兼容接口地址") ``` The caller-supplied destination and credential are then passed to the request function: ```python out["answer"] = call_llm( api_url=args.api_url, model=args.model, appkey=args.appkey, system_prompt=args.system_prompt, user_prompt=user_prompt, temperature=float(args.temperature), timeout=int(args.timeout), ) ``` ### Technical Analysis The `--api-url` argument accepts an unrestricted URL. `call_llm()` sends both the bearer credential and the complete user prompt to that destination without validating the URL scheme or hostname. There is no enforcement that the destination: - Uses HTTPS. - Matches the documented internal medical-model hostname. - Belongs to an approved endpoint allowlist. - Remains on the approved origin after an HTTP redirect. Consequently, anyone able to influence the command-line ar ...[truncated 2204 chars]- Remediation
View remediation
