T09 · Insecure Skill Coding Practices
- Location
scripts/local_generation.py:149- Finding
Unrestricted transmission of user content to a configurable endpoint
- Content
View full analysis
str: base_url = __import__("os").environ.get("HUMANIZE_LLM_BASE_URL", "").strip() if base_url: return base_url.rstrip("/") log_path = copaw_working_dir() / "copaw.log" if log_path.exists(): text = log_path.read_text(encoding="utf-8", errors="ignore") matches = re.findall(r"http://127\.0\.0\.1:(\d+)/health", text) if matches: port = matches[-1] return f"http://127.0.0.1:{port}/v1" matches = re.findall(r"llama\.cpp server started on port (\d+)", text) if matches: port = matches[-1] return f"http://127.0.0.1:{port}/v1" return "http://127.0.0.1:54841/v1" ``` ```python def call_chat( *, base_url: str, model: str, system_prompt: str, user_prompt: str, temperature: float = 0.3, max_tokens: int = 300, ) -> dict[str, Any]: if base_url.startswith("copaw-active://"): return _call_copaw_active_model( system_prompt=system_prompt, user_prompt=user_prompt, temperature=temperature, max_tokens=max_tokens, ) payload = { "model": model, "messages": [ {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}, ], "temperature": temperature, "max_tokens": max_tokens, } try: return _http_post_json(base_url.rstrip("/") + "/chat/completions", payload, timeout=120.0) except urllib.error.HTTPError as exc: detail = exc.read().decode("utf-8", errors="ignore") raise RuntimeError(f"L ...[truncated 2894 chars]- Remediation
View remediation
