T09 · Insecure Skill Coding Practices
- Location
scripts/insights.py:7- Finding
Plaintext Transmission of API Credentials and User Queries
- Content
View full analysis
Vulnerability Details
File Location:
scripts/insights.py, lines 7-53
Vulnerability Type: Sensitive data transmitted over unencrypted HTTP
Risk Level: HighVulnerable Code
python # Service root URL API_BASE_URL = "http://intra-znjs-yqt-agent-wx-beta.midu.cc".rstrip("/") def _resolve_api_key(base_url: str) -> str: """Prefer MIDU_API_KEY; otherwise GET {base}/apiKey.""" key = os.environ.get("MIDU_API_KEY") if key and key.strip(): return key.strip() url = f"{base_url}/apiKey" response = requests.get(url, timeout=60) response.raise_for_status() text = response.text.strip() if not text: return "" try: data = json.loads(text) if isinstance(data, dict): for k in ("key", "api_key", "token", "data"): v = data.get(k) if isinstance(v, str) and v.strip(): return v.strip() except json.JSONDecodeError: pass return textpython root = API_BASE_URL api_key = _resolve_api_key(root) chat_url = f"{root}/api/chat" headers = { "Content-Type": "application/json", "podName": "public-opinion-insights-skill-user", "podNameSpace": "beta-nlp", } if api_key: headers["Authorization"] = "Bearer %s" % api_key body = {"messages": [{"role": "user", "content": message}]} response = requests.post( chat_url, json=body, headers=headers, timeout=1200 )The same insecure endpoint is documented in
SKILL.mdline 22 andreferences/apikey-fetch.mdline 7:text http://intra-znjs-yqt-agent-wx-beta.midu.cc/apiKeyTechnical Analysis
The hardcoded service root uses HTTP rather than HTTPS. Consequently, both API-key provisioning through
GET /apiKeyand authenticated analysis requests throughPOST /api/chatlack transport encryption and cryptographic server authentica ...[truncated 2637 chars]- Remediation
View remediation
Remediation Suggestions
- Replace the service root with an HTTPS endpoint and require TLS for both
/apiKeyand/api/chat. - Fail closed if the configured URL does not use the
httpsscheme. - Preserve normal certificate and hostname verification; do not disable
requestsTLS verification. - Reject redirects from HTTPS to HTTP and preferably restrict redirects to an explicit trusted host allowlist.
- Remove the unauthenticated runtime
/apiKeyfallback where possible. RequireMIDU_API_KEYto be provisioned through an approved secret manager or protected OpenClaw configuration. - If remote key provisioning is operationally required, protect it with authenticated TLS and validate a strict response schema rather than accepting arbitrary response text.
- Ensure API keys are narrowly scoped, short-lived where possible, and revocable. Rotate any credential that may already have crossed an untrusted network.
- Update
SKILL.mdandreferences/apikey-fetch.mdto contain only the secure HTTPS endpoint and document the confidentiality implications of submitted queries. - Minimize transmitted query data and warn users not to include secrets or unrelated personal information.
- Add automated tests or static checks that reject plaintext service URLs for credential-bearing requests.
- Replace the service root with an HTTPS endpoint and require TLS for both
