T09 · Insecure Skill Coding Practices
- Location
scripts/omada_query.py:53- Finding
Controller credentials and access tokens may be transmitted without authenticated TLS
- Content
View full analysis
Vulnerability Details
File Location:
scripts/omada_query.py, lines 53-58 and 70-103
Vulnerability Type: Insecure transport of sensitive authentication material
Risk Level: HighVulnerable Code
python self.base_url = os.environ.get("OMADA_URL", "").rstrip("/") self.client_id = os.environ.get("OMADA_CLIENT_ID", "") self.client_secret = os.environ.get("OMADA_CLIENT_SECRET", "") self.omadac_id = os.environ.get("OMADA_OMADAC_ID", "") self.site_name = os.environ.get("OMADA_SITE", "") self.verify_ssl = os.environ.get("OMADA_VERIFY_SSL", "true").lower() != "false"python def _request(self, method: str, endpoint: str, **kwargs) -> dict: url = f"{self.base_url}{endpoint}" headers = kwargs.pop("headers", {}) headers["Content-Type"] = "application/json" if self.token: headers["Authorization"] = f"AccessToken={self.token}" resp = requests.request( method, url, headers=headers, verify=self.verify_ssl, **kwargs ) resp.raise_for_status() return resp.json() def get_controller_id(self): """Get the controller's omadacId from /api/info.""" if self.omadac_id: return resp = requests.get( f"{self.base_url}/api/info", verify=self.verify_ssl ) resp.raise_for_status() data = resp.json() self.omadac_id = data["result"]["omadacId"] def authenticate(self): """Get OAuth2 access token using client credentials.""" body = { "omadacId": self.omadac_id, "client_id": self.client_id, "client_secret": self.client_secret } resp = requests.post( f"{self.base_url}/openapi/authorize/token", params={"grant_type": "client_credentials"}, json=body, headers={"Content-Type": "application/json"}, verify=self.verify_ssl )Technical Analysis
The sensitive network transmission itself is necessary for client-credentials authentication against t ...[truncated 2378 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse
OMADA_URLwith a standard URL parser and reject every scheme other thanhttps. - Remove support for
OMADA_VERIFY_SSL=falsefrom normal operation. - For self-signed controllers, accept a user-provided CA bundle through a setting such as
OMADA_CA_BUNDLEand pass its path torequests. - Where a private CA is unavailable, support explicit certificate or public-key fingerprint pinning instead of disabling verification.
- Remove the global suppression of
InsecureRequestWarning. - Validate that the configured hostname matches the intended controller before sending credentials.
- Add explicit connection and response timeouts to all requests.
- Continue requiring a dedicated Viewer-only API application and document that administrative credentials must not be used.
- Avoid logging request bodies, authorization headers, client secrets, or complete authentication exceptions.
- Parse
