T09 · Insecure Skill Coding Practices
- Location
governed_agents/openclaw_wrapper.py:392- Finding
Authentication Token Disclosure to an Arbitrary HTTP Endpoint
- Content
View full analysis
TaskResult: import urllib.request import urllib.error if auth_token is None: auth_token = os.environ.get("GOVERNED_AUTH_TOKEN") or os.environ.get("AUTH_TOKEN") if not auth_token: # Fallback: look for .env in OPENCLAW_WORKSPACE/command-center/ env_path = WORKSPACE / "command-center" / ".env" if env_path.exists(): for line in env_path.read_text().splitlines(): line = line.strip() if line.startswith(("API_TOKEN=", "CC_AUTH_TOKEN=", "AUTH_TOKEN=")): auth_token = line.split("=", 1)[1].strip().strip('"').strip("'") break payload = json.dumps({ "objective": contract.objective, "acceptance_criteria": contract.acceptance_criteria, "required_files": contract.required_files, "model": "Codex", "timeout_seconds": contract.timeout_seconds, "agent_id": "main", }).encode() headers = {"Content-Type": "application/json"} if auth_token: headers["Authorization"] = f"Bearer {auth_token}" try: req = urllib.request.Request(endpoint, data=payload, headers=headers, method="POST") with urllib.request.urlopen(req, timeout=contract.timeout_seconds + 60) as resp: data = json.loads(resp.read()) ``` ### Technical Analysis The function accepts a caller-controlled `endpoint` without enforcing an allowed hostname, loopback-only policy, trusted origin, or HTTPS requirement. At the same time, ...[truncated 1551 chars]- Remediation
View remediation
