T09 · Insecure Skill Coding Practices
- Location
scripts/client.py:61- Finding
Configurable endpoints can redirect credentials and document contents to arbitrary hosts
- Content
View full analysis
str: try: parsed = urlparse(raw) except ValueError as exc: raise SkillError("CONFIG_ERROR", f"{name} must be a valid URL") from exc if parsed.username or parsed.password: raise SkillError("CONFIG_ERROR", f"{name} must not contain embedded credentials") is_loopback_http = allow_loopback_http and parsed.scheme == "http" and parsed.hostname in LOOPBACK_HOSTS if parsed.scheme != "https" and not is_loopback_http: raise SkillError("CONFIG_ERROR", f"{name} must use HTTPS (loopback HTTP is allowed)") if not parsed.hostname: raise SkillError("CONFIG_ERROR", f"{name} must include a hostname") return raw.rstrip("/") ``` ```python return cls( api_key=api_key, secret_key=secret_key, access_token=access_token, oauth_url=safe_endpoint(env("UNLIMITED_OCR_OAUTH_URL", BAIDU_OAUTH_URL), "UNLIMITED_OCR_OAUTH_URL"), submit_url=safe_endpoint(env("UNLIMITED_OCR_SUBMIT_URL", BAIDU_SUBMIT_URL), "UNLIMITED_OCR_SUBMIT_URL"), query_url=safe_endpoint(env("UNLIMITED_OCR_QUERY_URL", BAIDU_QUERY_URL), "UNLIMITED_OCR_QUERY_URL"), timeout_seconds=positive_float(timeout_seconds, "timeout_seconds", 7200), poll_interval_seconds=positive_float(poll_interval_seconds, "poll_interval_seconds", 60), ) ``` ```python def _access_token(client: httpx.Client, settings: BaiduSettings) -> str: if settings.access_token: return settings.access_token response = client.post(settings.oauth_url, params={ "grant_type": "client_credentials", "client_id": settings.api_key, "client_secret": settings.secret_key, }) value = _json_re ...[truncated 2634 chars]- Remediation
View remediation
