T09 · Insecure Skill Coding Practices
- Location
scripts/zworker_api.py:22- Finding
Unauthenticated Localhost API Used for Privileged Automation Control
- Content
View full analysis
Dict[str, Any]: """ Send an HTTP request to the zworker API. """ url = f"{BASE_URL}{endpoint}" if HAS_REQUESTS: try: if method.upper() == 'GET': response = requests.get(url, params=params, timeout=TIMEOUT) else: headers = {'Content-Type': 'application/json'} response = requests.post( url, params=params, json=data, headers=headers, timeout=TIMEOUT ) response.raise_for_status() result = response.json() except requests.exceptions.RequestException as e: raise ZworkerAPIError(f"HTTP request failed: {e}") except json.JSONDecodeError as e: raise ZworkerAPIError(f"Response JSON parsing failed: {e}") else: try: if params: from urllib.parse import urlencode url = f"{url}?{urlencode(params)}" req_data = None headers = {} if method.upper() == 'POST' and data: req_data = json.dumps(data).encode('utf-8') headers = {'Content-Type': 'application/json'} req = urllib.request.Request( url, data=req_data, headers=headers, method=method.upper() ) with urllib.request.urlopen(req, timeout=TIMEOUT) as response: response_data ...[truncated 3234 chars]- Remediation
View remediation
