T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/person_invest.py:313
- Finding
- Unmasked personal information is exposed through the unconditional JSON output## Vulnerability Details **File Location**: `scripts/person_invest.py:139-151` and `scripts/person_invest.py:313-316` **Vulnerability Type**: Sensitive information exposure through application output **Risk Level**: High ### Vulnerable Code ```python return { "success": True, "orderid": payload.get("orderid", ""), "name": name, "idcard": idcard, "mobile": mobile or "", "total_count": len(items), "lp_count": relation_counts["lp"], "tm_count": relation_counts["tm"], "sh_count": relation_counts["sh"], "items": items, } ``` ```python result = query_person_invest(name, idcard, mobile, api_key) print(format_result(result)) print("") print(json.dumps(result, ensure_ascii=False, indent=2)) ``` ### Technical Analysis The result object retains the complete name, national ID number, optional mobile number, and all records returned by the external API. Although `format_result()` masks the primary identity fields in its human-readable report, the script immediately serializes and prints the original result object without redaction. Consequently, the masking operation does not provide effective protection. The raw JSON can contain the full national ID number, mobile number, name, API response metadata, corporate relationships, positions, and investment information. This also conflicts with the Skill documentation requiring identity information to be displayed in masked form. The exposure does not require code execution or elevated operating-system privileges. Any component capable of reading command output—including an Agent transcript, terminal logger, CI job, process supervisor, support diagnostic collector, or user with access to redirected output—can obtain the data. ### Attack Path 1. A user invokes the Skill with a real name, national ID number, and optionally a mobile number. 2. The external service returns the requested corporate relationship records. 3. `f ...[truncated 894 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the unconditional raw JSON output and print only the redacted result from `format_result()`. 2. If structured output is required, create a separate redaction function that copies the result and masks or removes `name`, `idcard`, `mobile`, and any sensitive API response fields before serialization. 3. Make raw output available only through an explicit, prominently documented debugging option, and avoid allowing raw output in normal Agent operation. 4. Prefer a safe structured-output mode that exposes only fields required for the declared business query. 5. Add automated tests asserting that complete ID card numbers and mobile numbers never appear in default standard output or error output. 6. Document that query output must not be retained in shared logs and apply restrictive permissions if output is written to a file.
