T09 · Insecure Skill Coding Practices
Error
- Location
- starmemo.py:319
- Finding
- Automatic Collection and External Transmission of Conversation Data<![CDATA[ ## Vulnerability Details **File Location**: `starmemo.py:14-24`, `starmemo.py:145-210`, `starmemo.py:319-325`, `starmemo.py:426-429`; `v2/core.py:87-109`; `v2/ai_processor.py:69-89` **Vulnerability Type**: Excessive collection and disclosure of potentially sensitive conversation data **Risk Level**: High ### Vulnerable Code ```python def on_user_input(ctx, user_input): config = ctx.get("config", {}) if config.get("save", True): save_to_memory(ctx, user_input) return process_query(ctx, user_input) ``` ```python if msg and not msg.startswith("记忆配置") and allow_save: core = self.llm.optimize(msg) self.storage.save(msg, core) ``` ```python def _call_llm(self, prompt: str, max_tokens: int = 500) -> str: if not self.enable_ai: return "" headers = { "Content-Type": "application/json", "Authorization": f"Bearer {self.api_key}" } data = { "model": self.model, "messages": [{"role": "user", "content": prompt}], "temperature": self.temperature, "max_tokens": max_tokens } try: res = requests.post( self.api_endpoint, headers=headers, json=data, timeout=15 ) res.raise_for_status() return res.json()["choices"][0]["message"]["content"].strip() except Exception as e: print(f"⚠️ LLM call failed: {e}") return "" ``` ```python structured = self.ai.extract_structured(text) self.storage.save_daily( cause=structured.get("cause", text[:100]), change=structured.get("change", text[:200]), todo=structured.get("todo", ""), topic=structured.get("topic", "") ) knowledge_list = self.ai.extract_knowledge(text) ``` ### Technical Analysis The legacy input hook defaults to saving every user input when the `save` configuration field is absent. In the legacy message handler, almost every non-configuration message is passed to `LLMClient.optimize()` before be ...[truncated 2551 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Disable automatic capture and AI processing by default. 2. Require explicit user opt-in before enabling external LLM processing. 3. Save messages only following an explicit memory request or a narrowly defined, documented trigger. 4. Add per-message controls such as “do not save” and “process locally only.” 5. Detect and redact credentials, private keys, authentication headers, financial data, and common personal identifiers before storage or transmission. 6. Clearly disclose the destination provider and the categories of data sent before AI processing is enabled. 7. Separate local memory functionality from remote AI functionality so local saving does not implicitly trigger a network request. 8. Ensure disabling network access blocks both search and LLM API calls. 9. Add retention limits, memory deletion commands, and secure export controls. 10. Update `_meta.json`, `README.md`, and both skill manifests to declare network access and accurately describe the privacy model. ]]>
