T09 · Insecure Skill Coding Practices
- Location
scripts/ollama_embedding.py:13- Finding
Unrestricted Ollama endpoint can receive private query and memory content
- Content
View full analysis
bool: """Check Ollama service""" try: response = requests.get(f"{self.base_url}/api/tags", timeout=5) return response.status_code == 200 except: return False def embed(self, text: str) -> List[float]: """Generate embedding""" try: payload = {"model": self.model, "prompt": text} response = requests.post(self.api_url, json=payload, timeout=30) result = response.json() embedding = result.get('embedding', []) if embedding: self.dimension = len(embedding) return embedding except Exception as e: print(f"Embedding failed: {e}") return [] class MemoryWithOllama: """Memory system integrated with Ollama""" def __init__(self, memory_system, ollama: OllamaEmbedding = None): self.memory = memory_system self.ollama = ollama or OllamaEmbedding() self.cache = {} def semantic_search(self, query: str, limit: int = 10) -> List[Dict]: """Semantic search""" if not self.ollama.check_connection(): return self.memory.search(query, limit) query_emb = self.ollama.embed(query) if not query_emb: return self.memory.search(query, limit) memories = self.me ...[truncated 3079 chars]- Remediation
View remediation
