T09 · Insecure Skill Coding Practices
Error
- Location
- index.js:115
- Finding
- Sensitive crash data and proprietary source code are transmitted to an external AI service<![CDATA[ ## Vulnerability Details **File Location**: `index.js`, lines 115–151 **Vulnerability Type**: Excessive external disclosure of sensitive information **Risk Level**: High ### Vulnerable Code ```js const prompt = `You are an expert iOS Swift developer. Analyze this crash and fix it. ## Crash Information - **Error Name:** ${errorName} - **Message:** ${message} - **Platform:** ${crash.platform} - **App Version:** ${crash.app_version} - **User ID:** ${crash.user_id || "(anonymous)"} - **Device:** ${crash.device_info || "unknown"} ## Stack Trace \`\`\` ${stackTrace} \`\`\` ## Code from Repository ${codeContext || "No relevant code found"} ## Your Task 1. Analyze the stack trace to find the root cause 2. Search the codebase for relevant files 3. Identify the exact fix needed 4. Write the complete fixed code ## Response Format Respond with ONLY JSON: { "root_cause": "2-3 sentence explanation", "file_path": "full path to file that needs fixing", "fix_code": "complete replacement code", "search_terms": ["term1", "term2"] } If you cannot fix: {"cannot_fix": true, "reason": "why"}`; console.log(`[crash-fixer] Analyzing with MiniMax M2.5...`); const res = await fetch("https://api.minimax.chat/v1/text/chatcompletion_v2", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${process.env.ZAI_API_KEY}` }, body: JSON.stringify({ model: "MiniMax-M2.5", messages: [{ role: "user", content: prompt }], temperature: 0.2, max_tokens: 8000 }) }); ``` ### Technical Analysis The prompt sent to MiniMax contains crash messages, a user identifier, device information, stack traces, application metadata, and repository source code. Crash reports commonly contain personal data, authentication material, internal paths, memory values, and application state. Repository excerpts may contain proprietary implementation details or accidentally committed secrets. Some external AI analysis is consisten ...[truncated 1808 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `user_id` and detailed device identifiers from the model prompt unless they are demonstrably required for a specific diagnosis. 2. Redact credentials, access tokens, email addresses, IP addresses, file-system paths, and other personal or secret data from all crash fields. 3. Scan source excerpts for secrets before transmission and send only the smallest relevant functions or line ranges. 4. Require explicit operator approval before transmitting crash data or private source code to an external provider. 5. Provide a configurable trusted endpoint or local-model option for organizations that cannot disclose source code externally. 6. Document the exact AI provider, transmitted fields, retention expectations, and applicable privacy controls in `SKILL.md`. 7. Validate that the destination uses HTTPS and apply an allowlist rather than permitting arbitrary model endpoints. 8. Add audit logging that records the categories and volume of data transmitted without recording the sensitive content itself. 9. Align the declared environment requirements with the implementation, including the currently used `ZAI_API_KEY`. ]]>
