T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/search.py:38
- Finding
- Sensitive Search Query Disclosure Through Standard Output## Vulnerability Details **File Location**: `scripts/search.py`, line 38 **Vulnerability Type**: Sensitive data exposure through logging **Risk Level**: Medium **Vulnerable Code**: ```python try: parse_data = json.loads(query) print(f"success parse request body: {parse_data}") except json.JSONDecodeError as e: print(f"JSON parse error: {e}") ``` ### Technical Analysis After parsing the command-line JSON request, the script prints the complete request object to standard output. This object includes the user-supplied `query` and may also contain other request parameters. Search queries can contain personal information, confidential project names, internal infrastructure identifiers, authentication material pasted accidentally, or other sensitive data. Agent platforms, process supervisors, CI systems, and container runtimes commonly collect standard output in persistent logs. Consequently, data supplied for the search can be disclosed to parties with access to those logs. Printing the request is not necessary for the declared web-search functionality and therefore exceeds the minimum data handling required by the Skill. The API credential itself is not included in this output. ### Attack Path 1. A user or upstream Agent submits a request containing sensitive content in the `query` field. 2. The script parses the JSON request. 3. Line 38 writes the entire parsed request, including the sensitive query, to standard output. 4. The execution environment captures standard output in an Agent transcript, centralized logging service, terminal recording, CI log, or process-supervisor log. 5. A user or service with access to those records obtains the disclosed query. This path does not grant operating-system privileges or code execution. Its scope is the confidentiality of submitted search data and any systems that retain or expose the resulting logs. ### Impact Assessment An attacker or unauthorized log re ...[truncated 405 chars]
- Remediation
- ## Remediation Suggestions Remove the request-content logging statement entirely: ```python parse_data = json.loads(query) ``` If operational diagnostics are necessary: - Log only a generic event such as `Request parsed successfully`. - Do not log the query or the complete request object. - Keep diagnostic logging disabled by default. - Apply explicit redaction before logging any user-controlled structure. - Configure runtime logs with restrictive access controls, short retention periods, and encryption where appropriate.
