T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/resource_inventory.py:29
- Finding
- TLS Certificate Verification Is Unconditionally Disabled## Vulnerability Details **File Location**: `scripts/resource_inventory.py`, lines 29–30 and 73–75 **Vulnerability Type**: Improper TLS certificate validation **Risk Level**: High ### Vulnerable Code ```python import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) ``` ```python http_config = HttpConfig.get_default_config() http_config.ignore_ssl_verification = True http_config.timeout = 30 http_config.retry_times = 3 ``` ### Technical Analysis The HTTP configuration supplied to every Huawei Cloud SDK client unconditionally disables TLS certificate verification. The code also globally suppresses `InsecureRequestWarning`, preventing operators from noticing the insecure connection. The configuration is created by `_get_http_config()` and assigned to `ResourceInventory.http_config`. `_build_client()` then passes it to each service client through `.with_http_config(self.http_config)`. Consequently, inventory requests for ECS, BMS, RDS, EVS, DCS, CCE, VPC, EIP, ELB, NAT, and DNS all use this weakened TLS configuration. Without certificate and hostname validation, encryption alone does not authenticate the cloud API endpoint. A network-positioned attacker—or an attacker controlling a proxy configured through `HTTPS_PROXY` or `HTTP_PROXY`—can present an arbitrary certificate without causing the client to reject the connection. ### Attack Path 1. A user invokes the inventory script with valid Huawei Cloud AK/SK credentials. 2. `_get_http_config()` sets `ignore_ssl_verification` to `True`. 3. The script builds cloud service clients using this shared insecure HTTP configuration. 4. A network-positioned attacker intercepts traffic, or an untrusted configured proxy terminates the TLS connection using an attacker-controlled certificate. 5. Because certificate verification is disabled, the SDK accepts the unauthenticated endpoint. 6. The attacker can observe requests and returned tenant inventory or alter API responses before they reach th ...[truncated 886 chars]
- Remediation
- ## Remediation Suggestions - Remove `http_config.ignore_ssl_verification = True` and retain the SDK's secure certificate-verification default. - Remove global suppression of `urllib3.exceptions.InsecureRequestWarning`. - If an enterprise proxy or private certificate authority is required, configure an explicit trusted CA bundle while preserving certificate-chain and hostname validation. - Reject invalid or untrusted proxy certificates rather than silently continuing. - Add tests confirming that connections using expired, hostname-mismatched, self-signed, or otherwise untrusted certificates fail closed. - Document secure proxy configuration and avoid offering a general-purpose option that disables TLS verification.
