T09 · Insecure Skill Coding Practices
- Location
scripts/search.py:36- Finding
Sensitive Search Query Exposed Through Standard Output Logging
- Content
View full analysis
Vulnerability Details
File Location:
scripts/search.py, line 36
Vulnerability Type: Plaintext logging of potentially sensitive input
Risk Level: MediumVulnerable Code
python parse_data = json.loads(query) print(f"success parse request body: {parse_data}")Technical Analysis
The script logs the complete parsed request object to standard output. This object contains the user-supplied
queryand may also contain other request parameters.Search queries can include confidential business information, personal data, credentials pasted accidentally, internal identifiers, or unreleased project details. In agent and automation environments, standard output is commonly captured by execution frameworks, centralized logging systems, CI/CD records, or monitoring services. The log statement therefore creates an unnecessary secondary copy of potentially sensitive information.
Logging the query is not required to perform the declared Baidu web-search functionality and exceeds the minimum data handling necessary for successful operation. The intentional transmission of the query and API credential to the fixed HTTPS Baidu API endpoint is consistent with the declared functionality; the additional local logging is not.
Attack Path
- A user or calling agent supplies JSON containing sensitive text in the
queryfield. - The script parses the JSON with
json.loads. - Line 36 interpolates the entire parsed object into a plaintext status message.
- The process writes that message to standard output.
- An execution platform, logging agent, or shell transcript captures and retains the output.
- A person or service with access to those logs can recover the sensitive query without requiring access to the Baidu API request in transit.
This issue does not directly grant code execution, elevated system privileges, or access to the
BAIDU_API_KEY. Its scope is disclosure of user-provided request dat ...[truncated 706 chars]- A user or calling agent supplies JSON containing sensitive text in the
- Remediation
View remediation
Remediation Suggestions
Remove the logging of the parsed request body:
python parse_data = json.loads(query)If a success message is operationally necessary, use a constant message that does not contain user input:
python parse_data = json.loads(query) print("Request parsed successfully.")Additional hardening measures:
- Disable request-content logging by default.
- If diagnostic logging is needed, make it explicitly opt-in and redact the
queryfield. - Document that search queries are transmitted to Baidu's API and should not contain secrets.
- Configure execution and centralized logging systems with access controls, short retention periods, and appropriate deletion policies.
- Prefer structured logs with an allowlist of non-sensitive metadata rather than serializing complete request objects.
