T09 · Insecure Skill Coding Practices
- Location
- main.py:128
- Finding
- Task Completion Messages Are Exposed Through URL Query Parameters<![CDATA[ ## Vulnerability Details **File Location**: `main.py:128-139` **Vulnerability Type**: Sensitive information exposure through URL query parameters **Risk Level**: Medium ### Vulnerable Code ```python body = {"status": status} if message: body["message"] = message try: resp = requests.post( f"{BASE_URL}/api/cron-task/{task_id}/done", headers=headers, params=body, timeout=15 ) ``` ### Technical Analysis The `status` and user-controlled completion `message` are passed through the HTTP client's `params` argument. This places both values in the request URL query string rather than the POST body. URLs are routinely recorded by web-server access logs, reverse proxies, API gateways, observability platforms, and network debugging tools. Although HTTPS protects the URL while it is in transit, it does not prevent endpoint infrastructure from logging it. Completion messages can contain error details, operational data, customer references, or other sensitive information derived from the user's task. Using query parameters is not necessary for the declared completion-update functionality. The request already declares a JSON content type, so these values should be sent in a JSON request body. ### Attack Path 1. A user or agent invokes `done --msg` with sensitive operational information. 2. `complete_task()` assigns that information to `body["message"]`. 3. The HTTP client serializes `body` into the URL because it is supplied as `params=body`. 4. The resulting URL is processed by the remote server and any intervening proxy or API gateway. 5. Access logs or monitoring records retain the full query string. 6. Anyone with access to those records can recover the completion message. This does not provide direct local code execution or privilege escalation, but it expands access to sensitive content beyond the intended API data-processing path. ### Impact Assessment The exposed scope is limited to the completion statu ...[truncated 350 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Send completion data in the POST body: ```python resp = requests.post( f"{BASE_URL}/api/cron-task/{task_id}/done", headers=headers, json=body, timeout=15 ) ``` Additional hardening should include: - Validate and limit the length of completion messages. - Warn users not to include credentials or unnecessary personal data. - Configure servers, gateways, and monitoring systems to redact sensitive fields. - Confirm that the service does not include request bodies in unrestricted diagnostic logs. - Add a regression test verifying that `message` never appears in the generated URL. ]]>
