T09 · Insecure Skill Coding Practices
Warning
- Location
- example-integration.js:49
- Finding
- Plaintext Logging of User Messages and Session Identifiers<![CDATA[ ## Vulnerability Details **File Location**: `example-integration.js`, lines 49–70 **Vulnerability Type**: Sensitive information exposure through plaintext application logs **Risk Level**: Medium ### Vulnerable Code ```javascript async function processModelCall(sessionKey, messages, meta) { const merged = mergeMessages(messages); console.log( `\n[${sessionKey}] Processing batched input:\n` + ` Messages: ${meta.batchSize}\n` + ` Saved calls: ${meta.savedCalls}\n` + ` Message IDs: ${meta.messageIds.join(', ')}\n` ); try { // Call your model here // const result = await yourModel.complete(merged); // Placeholder for demo console.log(`[${sessionKey}] Model would receive:\n${merged}\n`); const result = `[Mock response to batch of ${meta.batchSize} messages]`; // Send response back to session await sendToSession(sessionKey, result); } catch (err) { console.error(`[${sessionKey}] Model call failed:`, err); // Add retry logic here if needed } } ``` ### Technical Analysis The exported integration example writes session keys, message identifiers, and the complete merged contents of user messages to standard output. Because this file is presented as a copy-and-adapt integration template, these logging statements may be retained when the code is deployed. User messages can contain authentication tokens, personal information, financial records, proprietary data, or other confidential material. Standard output is commonly collected by container platforms, process managers, cloud logging systems, and observability services. Consequently, information intended only for the model-processing workflow may be copied into systems with broader access, longer retention periods, or weaker controls. The logging occurs unconditionally and provides no production-mode guard, redaction, allowlist, or explicit opt-in mechanism. ### Attack Path 1. An application integrates or adapts the exported `ex ...[truncated 1378 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove logging of `merged` and all raw user-message content from the integration example. 2. Log only non-sensitive aggregate information, such as batch size, processing duration, and an internally generated non-reversible correlation value. 3. Avoid logging raw session keys and message IDs. If correlation is required, use a keyed hash or short-lived opaque identifier. 4. Make diagnostic logging explicitly opt-in and disabled by default in production. 5. Add a centralized redaction layer that removes credentials, authorization headers, tokens, email addresses, and other recognized sensitive fields before any diagnostic output. 6. Document that application logs must not contain conversation content and recommend restricted access, encryption, short retention periods, and auditing for log stores. 7. Replace the vulnerable statements with a minimal pattern such as: ```javascript if (options.debug === true) { console.log('Processing message batch', { batchSize: meta.batchSize, savedCalls: meta.savedCalls, }); } ``` 8. Add automated tests or linting rules that prevent raw message objects and merged prompts from being passed to logging functions. ]]>
