T09 · Insecure Skill Coding Practices
Warning
- Location
- src/feishu_voice.py:187
- Finding
- Unnecessary Disclosure of the Complete User Prompt to the TTS Provider## Vulnerability Details **File Location**: `src/feishu_voice.py:187-190` and `src/feishu_voice.py:372` **Vulnerability Type**: Excessive transmission of potentially sensitive user data **Risk Level**: Medium ### Vulnerable Code ```python # Add context_texts when context is provided if context: payload["req_params"]["additions"] = json.dumps({ "context_texts": [context] }) ``` ```python # Generate voice opus_path = generate_voice(text, emotion, user_input) ``` ### Technical Analysis `send_voice_message()` passes the complete `user_input` value to `generate_voice()` as its `context` argument. The function then adds that value to the TTS request as `context_texts`, causing it to be transmitted to `https://openspeech.bytedance.com`. This exceeds the minimum data required to synthesize the requested voice message. The code already calls `detect_emotion()` locally and derives an emotion label, but the `emotion` argument accepted by `generate_voice()` is not used in the outgoing request. Instead, the full original prompt is transmitted. Although the transmission uses HTTPS and targets the documented TTS provider, `user_input` may contain secrets, personal information, identifiers, unrelated conversation details, or instructions that are not part of the text the user requested to synthesize. The documentation describes the context as being used for emotion awareness, but it does not adequately communicate that the complete original request is shared with the external provider. ### Attack Path 1. A caller invokes `send_voice_message()` with legitimate synthesis text. 2. The caller or surrounding Agent places sensitive or unrelated information in `user_input`. 3. `send_voice_message()` passes the complete value to `generate_voice()`. 4. `generate_voice()` serializes it into `req_params.additions.context_texts`. 5. The complete prompt is transmitted to the external ByteDance TTS endpoint. 6. The ...[truncated 635 chars]
- Remediation
- ## Remediation Suggestions - Do not send the raw `user_input` value to the TTS service by default. - Use only the locally derived emotion classification, such as `happy`, `sad`, or `neutral`, if the provider supports an equivalent constrained parameter. - If contextual text is indispensable, require explicit user consent before sharing it with the external service. - Restrict context to a short, purpose-specific value and apply sensitive-data filtering. - Document precisely which fields are transmitted, to which provider, and for what purpose. - Remove the unused `emotion` argument or implement it through a constrained provider-supported option rather than forwarding the complete prompt.
