T09 · Insecure Skill Coding Practices
- Location
scripts/kb.py:108- Finding
Remote endpoints can transmit credentials and sensitive knowledge-base content over plaintext HTTP
- Content
View full analysis
Any: data = None if body is None else json.dumps(body).encode("utf-8") hdrs = {"Accept": "application/json"} if body is not None: hdrs["Content-Type"] = "application/json" if headers: hdrs.update(headers) req = urllib.request.Request(url, data=data, headers=hdrs, method=method) try: with urllib.request.urlopen(req, timeout=timeout) as resp: raw = resp.read().decode("utf-8", "replace") return json.loads(raw) if raw else {} except urllib.error.HTTPError as err: detail = err.read().decode("utf-8", "replace") raise SystemExit(f"HTTP {err.code} {method} {url}\n{detail}") from err except urllib.error.URLError as err: raise SystemExit(f"URL error {method} {url}: {err}") from err def qdrant_headers(cfg: dict[str, Any]) -> dict[str, str]: h: dict[str, str] = {} if cfg.get("qdrant_api_key"): h["api-key"] = cfg["qdrant_api_key"] return h def embed_texts(cfg: dict[str, Any], texts: list[str]) -> list[list[float]]: missing_embed = [ name for name, val in ( ("EMBEDDING_BASE_URL", cfg.get("embed_base")), ("EMBEDDING_API_KEY", cfg.get("embed_key")), ("EMBEDDING_MODEL", cfg.get("embed_model")), ) if not val ] if missing_embed: raise SystemExit( "Missing embedding config: " + ", ".join(missing_embed) + f". Fill them ...[truncated 3864 chars]- Remediation
View remediation
