T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/triage.py:125
- Finding
- Issue Content Is Sent to a Third-Party LLM Without an Explicit Enablement or Privacy Control## Vulnerability Details **File Location**: `scripts/triage.py`, lines 125-168 **Vulnerability Type**: Uncontrolled disclosure of repository issue content to a third-party service **Risk Level**: Medium **Vulnerable Code**: ```python def _llm_classify(self, title: str, body: str) -> Optional[str]: """使用 LLM 分类 Issue""" prompt = f""" 请分析这个 GitHub Issue 并分类为以下类型之一:bug, enhancement, question, documentation 标题:{title} 描述:{body[:500]} 只返回类型名称(bug/enhancement/question/documentation),不要其他内容。 """ try: # 调用 DashScope API url = 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation' headers = { 'Authorization': f'Bearer {DASHSCOPE_API_KEY}', 'Content-Type': 'application/json' } data = { 'model': 'qwen-plus', 'input': { 'messages': [ {'role': 'user', 'content': prompt} ] } } response = requests.post(url, headers=headers, json=data) response.raise_for_status() ``` The API key is described as optional, but the fallback value does not disable the integration: ```python DASHSCOPE_API_KEY = os.getenv('DASHSCOPE_API_KEY', 'sk-xxx') ``` ### Technical Analysis Every classification invokes `_llm_classify`, which embeds the complete issue title and the first 500 characters of the issue body in a request to DashScope. There is no dedicated configuration switch, consent gate, content-redaction stage, or check that a real DashScope key has been configured. Consequently, the program attempts to disclose issue content even when the user has not configured the supposedly optional AI integration. An invalid key may cause the service to reject processing, but the HTTP request body still reaches the third-party endpoint. This behavior also occurs in `--dry-run` mode: dry-run prevents GitHub modifi ...[truncated 1552 chars]
- Remediation
- ## Remediation Suggestions 1. Make LLM processing explicitly opt-in, for example with `triage.use_llm: false` as the secure default. 2. Do not assign a placeholder API key as a functional default. Use an empty value and skip `_llm_classify` unless a nonempty key is present. 3. Clearly disclose that issue content is sent to DashScope before enabling the integration. 4. Add a local-only mode and ensure `--dry-run` does not contact third-party AI services unless the user separately requests it. 5. Redact likely secrets, credentials, email addresses, internal URLs, and other configured patterns before constructing the prompt. 6. Allow administrators to restrict which repositories and issue fields may be processed externally. 7. Add explicit request timeouts, such as `timeout=(5, 30)`, and bounded retry behavior. 8. Add tests verifying that no DashScope request occurs when the API key or opt-in setting is absent. 9. Document the provider's retention, regional processing, and privacy implications.
