T09 · Insecure Skill Coding Practices
- Location
scripts/fts5_index.py:329- Finding
Private Memory Disclosure Through an Unrestricted LLM Endpoint
- Content
View full analysis
str: """Use an LLM to summarize search results.""" if not results: return f"No memory related to {query} was found" context = self._build_context(results, max_context) prompt = f"""You are an assistant for a secretary-style memory system. Summarize information related to the user query: {query}. ## Search Results {context} """ summary = self._call_llm(prompt) return summary ``` The original prompt in the file is written in Chinese, but its interpolated sensitive fields are produced by the following code: ```python def _build_context(self, results: List[Dict], max_context: int) -> str: """Build LLM context.""" context_parts = [] total_len = 0 for i, r in enumerate(results, 1): part = f""" --- Result {i} --- File: {r['path']} Date: {r['date']} Partition: {r['partition']} Content: {r['content'][:1000]} """ part_len = len(part) if total_len + part_len > max_context: break context_parts.append(part) total_len += part_len return "\n".join(context_parts) ``` ```python def _call_llm(self, prompt: str) -> str: """Call the LLM API.""" import urllib.request import urllib.error if not self.api_url or self.api_url == "http://localhost:11434/api/generate": raise LLMSummarizationError( "LLM API is not configured or accessible.", hint="Set LLM_API_URL to your LLM ...[truncated 3310 chars]- Remediation
View remediation
