T09 · Insecure Skill Coding Practices
- Location
metacognition.py:42- Finding
Unrestricted Embeddings URL Can Disclose Conversation-Derived Data
- Content
View full analysis
bool: """Check if the local embeddings endpoint is reachable.""" global _embeddings_available if _embeddings_available is not None: return _embeddings_available try: result = subprocess.run( ["curl", "-s", "-m", "2", "-X", "POST", EMBEDDINGS_URL, "-H", "Content-Type: application/json", "-d", json.dumps({"input": "test"})], capture_output=True, text=True, timeout=5, ) if result.returncode == 0 and result.stdout.strip(): resp = json.loads(result.stdout) if "data" in resp and resp["data"]: _embeddings_available = True return True except Exception: pass _embeddings_available = False return False def get_embedding(text: str) -> "list": """Get embedding vector from local endpoint. Returns None on failure.""" if not _test_embeddings(): return None try: result = subprocess.run( ["curl", "-s", "-m", "10", "-X", "POST", EMBEDDINGS_URL, "-H", "Content-Type: application/json", "-d", json.dumps({"input": text[:2000]})], # truncate long texts capture_output=True, text=True, timeout=15, ) if result.returncode == 0: resp = json.loads(result.stdout) return resp["data"][0]["embedding"] except Exception: pass return None ``` ### Technical Analysis `EMBEDDINGS_URL` is accepted ...[truncated 2764 chars]- Remediation
View remediation
