T09 · Insecure Skill Coding Practices
- Location
scripts/dify_chat.py:61- Finding
Bearer Token and Confidential Queries May Be Transmitted Over Unencrypted HTTP
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill does what it says by sending questions to a configured Dify API, but it can transmit an API token and internal questions to an unrestricted or unencrypted endpoint.
Review the configured DIFY_API_BASE before installing or using this skill. Use only a trusted HTTPS Dify endpoint, avoid sending secrets or highly sensitive company data in prompts, and treat the advertised multi-turn and streaming features as unreliable until fixed.
scripts/dify_chat.py:61Bearer Token and Confidential Queries May Be Transmitted Over Unencrypted HTTP
The documented behavior materially differs from the described implementation: multi-turn context is reportedly unsupported because conversation_id is fixed empty, streaming is claimed while response_mode is blocking, and the call is a general chat API rather than a constrained knowledge-base/workflow interaction. This mismatch can mislead users into sending sensitive internal queries under the false assumption of local-only, scoped, conversational behavior, increasing the chance of unintended data disclosure or policy bypass.
Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.
try:
json_data = json.loads(decoded_line[6:])
# Extract conversation_id
if conversation_id is None and json_data.get("conversation_id"):
conversation_id = json_data["conversation_id"]
print(f"\033[1;33m💬 Conversation ID: {conversation_id}\033[0m", file=sys.stderr)
The skill documents file reads of a local config file and outbound network access to a Dify API, but it declares no explicit tool scope or permission boundaries. In an agent ecosystem, missing scope declarations can cause overbroad invocation and reduce operator visibility into what resources the skill may access or transmit to external services.
The activation criteria are broad enough to trigger on generic requests like querying a knowledge base, which may cause the agent to invoke this networked skill in more situations than users expect. In a corporate setting, overbroad routing raises the risk that sensitive prompts or proprietary documents are sent to the Dify backend without sufficiently explicit user intent.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
- Dify 服务未启动
**解决**:
1. 确认 Base URL 正确:`curl -I http://your_DIFY_API_BASE
2. 检查网络连通性
3. 验证 Dify 服务状态
The manifest and module docs say the skill supports multi-turn conversation for a single workflow, and the CLI accepts a conversation ID argument. However, the API payload always sends an empty "conversation_id" and never uses the provided conv_id parameter, so follow-up turns are not continued as claimed.
The script transmits raw user queries to an HTTP endpoint without any user-facing disclosure or consent prompt, even though the skill is explicitly meant for internal knowledge-base usage where prompts may contain sensitive company information. In this context, users may reasonably assume a local/private action, so silent external transmission increases the risk of unintended data disclosure.
The code sends user-supplied query content and an API bearer token to a configured remote service via requests.post. In a knowledge-base skill handling internal company questions, this is security-relevant because sensitive prompts can leave the local trust boundary, especially if DIFY_API_BASE is misconfigured to a non-HTTPS or untrusted endpoint.
print("\033[0;34m🔄 Calling Dify API...\033[0m")
try:
response = requests.post(url, headers=headers, json=payload, stream=True)
response.raise_for_status()
conversation_id = None
L156 与 L177 的排障说明提到需要添加或配置 DIFY_WORKFLOW_ID,但前面的环境变量定义仅包含 DIFY_API_KEY、DIFY_API_BASE 和 DIFY_USER,且流程图与示例调用也都围绕 /chat-messages 对话接口展开。这属于文档内部对技能意图和所需配置的主动矛盾,容易误导用户以为该技能实际执行的是 workflow run 而非对话查询。
The natural-language description, examples, and CLI help are presented in Chinese only, with no indication that users may choose another language or that the tool is intentionally region-specific. Under the stated policy, a fixed language/locale without opt-in or justification is a natural-language policy concern.
The comments say the call was changed to use streaming, but the actual payload sets "response_mode" to "blocking". This is an active contradiction between inline documentation and code behavior, especially relevant because the skill description emphasizes streamed responses.