T09 · Insecure Skill Coding Practices
- Location
scripts/detect_env.py:31- Finding
Gateway Authentication Token Exposed in Plaintext Output
- Content
View full analysis
/dev/null") if result and result != "null": return result.strip('"') except Exception: pass # Fallback: read from config file config_path = os.path.expanduser("~/.openclaw/openclaw.json") if os.path.exists(config_path): try: import re with open(config_path) as f: content = f.read() # Simple regex for token field (JSON5 may have comments) m = re.search(r'"token"\s*:\s*"([^"]+)"', content) if m: return m.group(1) except Exception: pass return None ``` ```python result = { "install_type": install_type, "workspace": get_workspace(), "gateway_token": get_gateway_token(), "gateway_port": get_gateway_port(), "stats_running": stats_running, "stats_port": 8765, "public_ip": get_public_ip(), "lan_ip": get_lan_ip(), "tailscale_ip": tailscale_ip, "tailscale_hostname": tailscale_hostname, "nginx_available": nginx_available(), "tailscale_available": tailscale_available(), "os": detect_os(), } print(json.dumps(result, indent=2)) ``` The associated Skill instructions also require the token to be placed in the connection summary: ```text ✅ OpenClaw iOS Setup Complete Gateway URL: https://your-domain-or-ip Token: your-token-here ``` ### Technical Analysis The environment detector retrieves a reusable gateway authentication token from either the OpenClaw CLI or the local configuration file. It then includes the complete token in JSON written to standard output. Tool output may be re ...[truncated 1736 chars]- Remediation
View remediation
