T09 · Insecure Skill Coding Practices
- Location
scripts/clients/http_client.py:59- Finding
TLS certificate verification is disabled for authenticated API traffic
- Content
View full analysis
Vulnerability Details
File Location:
scripts/clients/http_client.py:59-76,scripts/clients/http_client.py:150-155,scripts/clients/api_client.py:72-76,scripts/clients/api_client.py:92-97,scripts/eval_skill.py:382-393,scripts/eval_skill.py:967-978,scripts/eval_skill.py:1017-1030
Vulnerability Type: Improper certificate validation
Risk Level: HighVulnerable Code
python class BaseHttpClient: def __init__( self, base_url: str = "", timeout: int = DEFAULT_TIMEOUT, max_retries: int = MAX_RETRIES, retry_backoff_factor: float = RETRY_BACKOFF_FACTOR, verify_ssl: bool = False ): self.base_url = base_url.rstrip('/') if base_url else "" self.timeout = timeout self.max_retries = max_retries self.retry_backoff_factor = retry_backoff_factor self.verify_ssl = verify_ssl self.session = self._create_session()python kwargs.setdefault("timeout", self.timeout) kwargs.setdefault("verify", self.verify_ssl) headers = kwargs.pop("headers", {}) headers.setdefault("Content-Type", "application/json") headers = self._inject_auth(headers) kwargs["headers"] = headers resp = self.session.request(method, url, **kwargs)The authenticated API client explicitly preserves the insecure setting:
python super().__init__( base_url=base_url, timeout=timeout, verify_ssl=False )Bearer credentials are then attached to requests:
python def _inject_auth(self, headers: Dict[str, str]) -> Dict[str, str]: token = self.token_manager.get_token() headers["Authorization"] = f"Bearer {token}" if self._username: headers["x-consumer-username"] = self._username return headersMultipart uploads also explicitly disable validation:
python resp = requests.post( f"{base_url}/eval/api/v1/skill/eval-resource/file", headers=_bearer_headers(auth_file), files=files, data=data_form, timeout= ...[truncated 2366 chars]- Remediation
View remediation
Remediation Suggestions
- Change the HTTP client default to certificate verification enabled:
python verify_ssl: bool = True- Remove every explicit
verify=Falseargument from multipart upload requests. - Remove global suppression of
InsecureRequestWarning. - If the service uses a private certificate authority, configure
verifywith a controlled CA bundle path instead of disabling verification. - Reject non-HTTPS platform base URLs before attaching Bearer credentials.
- Restrict the configured service origin to an explicit allowlist before sending authorization headers.
- Add automated tests confirming that invalid, expired, self-signed, and hostname-mismatched certificates are rejected.
- Rotate potentially exposed tokens after deploying the correction.
