T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/core.py:10
- Finding
- Authentication Credentials and Trading Data Are Transmitted over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `scripts/core.py:10-11, 115-131, 145-146, 173-178, 311-329`; `scripts/cli.py:11`; `SKILL.md:137, 238` **Vulnerability Type**: Plaintext transmission of sensitive information and insufficient endpoint trust enforcement **Risk Level**: High ### Vulnerable Code ```python class PlazaClientCore: """Core functionality for the Plaza client""" def __init__(self, api_base_url: str = "http://115.190.255.55:80/api/v1", config_file: str = None): self.api_base_url = api_base_url.rstrip("/") ``` ```python def _call_api(self, endpoint: str, method: str = "POST", data: Optional[dict] = None, headers: Optional[dict] = None) -> dict: url = f"{self.api_base_url}/{endpoint}" request_headers = {"Content-Type": "application/json"} if headers: request_headers.update(headers) if self.agent_token: request_headers["Authorization"] = f"Bearer {self.agent_token}" try: if method == "POST": response = requests.post( url, json=data, headers=request_headers, timeout=10 ) elif method == "GET": response = requests.get( url, params=data, headers=request_headers, timeout=10 ) else: raise ValueError(f"Unsupported HTTP method: {method}") response.raise_for_status() return response.json() ``` ```python def enter_plaza(self, agent_name: str, owner_persona: str, target_persona: str, metadata: Optional[dict] = None) -> dict: """Enter the plaza and get agent credentials.""" payload = { "agent_name": agent_name, "owner_persona": owner_persona, "target_persona": target_persona, "metadata": metadata or {} } response = self._call_api("enter_plaza", data=payload) ``` ```python parser.add_argument( "--api-base-url", default="http://115.190.255.55:80/api/v1", help="B ...[truncated 2813 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the HTTP endpoint with an authenticated HTTPS hostname: ```python DEFAULT_API_BASE_URL = "https://api.agentnego.example/api/v1" ``` 2. Reject non-HTTPS endpoints before any credentials are loaded or transmitted: ```python from urllib.parse import urlparse parsed = urlparse(api_base_url) if parsed.scheme != "https": raise ValueError("The API endpoint must use HTTPS") ``` 3. Maintain an allowlist of trusted API hostnames. Do not rely on a bare IP unless certificate identity is securely configured. 4. Bind stored credentials to the exact trusted origin that issued them. Refuse to attach a stored token when the scheme, hostname, or port changes. 5. Never disable TLS certificate verification. Consider certificate or public-key pinning where the deployment model supports secure pin rotation. 6. Separate initial registration from authenticated requests so that existing credentials cannot be sent to a newly supplied endpoint automatically. 7. Avoid placing sensitive data in error messages or logs, and document exactly which owner information is transmitted. 8. Rotate all tokens that may previously have been transmitted over plaintext HTTP after secure transport is deployed. ]]>
