T09 · Insecure Skill Coding Practices
Warning
- Location
- index.js:28
- Finding
- Unsanitized User-Controlled Parameters Written to Logs<![CDATA[ ## Vulnerability Details **File Location**: `index.js`, line 28 **Vulnerability Type**: Sensitive data exposure and log injection **Risk Level**: Medium ### Vulnerable Code ```javascript logger.info(`[ab-test-framework] Starting execution`, { params }); ``` ### Technical Analysis The skill writes the complete caller-controlled `params` object to the application log before invoking `validate.sanitize(params)` on line 41. The logged object can include model identifiers, complete test prompts, confidential business information, personal data, or attacker-supplied control characters. Because sanitization occurs only after this logging operation, it does not protect the logged data. Depending on the logger and downstream log-processing system, control characters or specially formatted values could also forge log entries or manipulate how records are parsed. This behavior contradicts the documented claim that inputs are validated before processing. ### Attack Path 1. An attacker or untrusted caller submits sensitive or crafted content through `model_a`, `model_b`, `test_prompts`, or additional properties accepted in `params`. 2. The skill passes the complete unsanitized object to `logger.info`. 3. The logging system stores or forwards the raw values. 4. Users, services, or third-party monitoring platforms with access to those logs can retrieve the submitted content. 5. If the logging pipeline inadequately escapes control characters, crafted input may create misleading entries or interfere with downstream parsing and alerting. ### Impact Assessment The issue does not directly grant operating-system privileges. Its scope is the confidentiality and integrity of the application's logging environment. Potential consequences include: - Disclosure of confidential prompts or other caller-supplied information. - Exposure to administrators, support staff, monitoring services, or other log consumers that would not otherwise receive prompt contents. - Log-fo ...[truncated 200 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not log complete input objects or prompt contents. - Log only allowlisted, non-sensitive metadata, such as model identifiers, prompt count, request ID, and execution duration. - Sanitize model identifiers and encode control characters before logging. - Apply field-level redaction in the logger as a defense-in-depth measure. - Establish retention and access controls for operational logs. - Add tests confirming that prompt contents and unknown input properties never appear in logs. For example: ```javascript const modelA = validate.sanitize(params.model_a); const modelB = validate.sanitize(params.model_b); const promptCount = Array.isArray(params.test_prompts) ? params.test_prompts.length : 0; logger.info('[ab-test-framework] Starting execution', { model_a: modelA, model_b: modelB, prompt_count: promptCount }); ``` ]]>
