T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/numpy_store.py:164
- Finding
- Undeclared transmission of document and query contents to configurable network services<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:1-7`; `scripts/numpy_store.py:164-202`; `scripts/lancedb_store.py:166-199`; `scripts/lightrag_store.py:223-258`; `scripts/milvus_store.py:234-269`; `scripts/pgvector_store.py:206-241`; `scripts/qdrant_store.py:210-251`; `scripts/weaviate_store.py:225-260` **Vulnerability Type**: Undeclared outbound data transmission and insufficient endpoint restrictions **Risk Level**: Medium ### Relevant Code The Skill metadata declares that outbound networking is disabled: ```yaml --- name: vector-store-shootout version: 1.0.0 description: 8 vector store implementations behind a common interface — numpy, lancedb, qdrant, pgvector, weaviate, weaviate_hybrid, milvus, lightrag. Use when evaluating RAG backends, building vector search, or comparing embedding stores. Each backend is a drop-in replacement via the base class. metadata: {"openclaw": {"emoji": "🔍", "requires": {"bins": ["python3"], "env": []}, "primaryEnv": null, "network": {"outbound": false, "reason": "All backends run locally. Network calls depend on your deployment (e.g. managed Qdrant Cloud)."}}} --- ``` However, the backends send the complete `texts` list to a configurable Ollama endpoint and, when explicitly configured with an API key, can fall back to OpenAI. The following representative implementation appears in `scripts/numpy_store.py`: ```python def _embed(self, texts: list[str]) -> list[list[float]]: """Priority: embed_fn (tests) → Ollama → OpenAI → TF-IDF.""" if self._embed_fn: return self._embed_fn(texts) if self._ollama_url: try: return self._ollama_embed(texts) except Exception as exc: logger.warning("Ollama embed failed, trying OpenAI: %s", exc) if self._openai_key: try: return self._openai_embed(texts) except Exception as exc: logger.warning("OpenAI embed failed, using TF-IDF: %s", exc) logger.warning("All embedding provide ...[truncated 3576 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Correct `SKILL.md` so the network declaration explicitly identifies: - Local Ollama HTTP access. - Optional OpenAI API access. - Connections to Qdrant, PostgreSQL, Weaviate, and Milvus services. 2. Default to an offline embedding function or require explicit network opt-in before any content is transmitted. 3. Validate `ollama_url` with a proper URL parser: - Permit only `http://localhost`, `http://127.0.0.1`, and `http://[::1]` by default. - Require a separate explicit option for remote endpoints. - Require HTTPS for non-loopback destinations. - Reject embedded credentials, unsupported schemes, redirects to disallowed hosts, and malformed URLs. 4. Disable automatic OpenAI fallback unless the caller explicitly opts into remote fallback after receiving a data-disclosure warning. 5. Provide an embedding-provider policy such as `offline`, `local`, or `remote`, with `offline` or `local` as the secure default. 6. Document that complete document and query contents—not merely derived embeddings—are sent to embedding providers. 7. Consider destination allowlisting and redirect blocking to reduce internal-network request risks. 8. Add tests confirming that offline mode makes no network calls and that non-loopback URLs are rejected unless explicitly authorized. ]]>
