similarity-search-patterns
Warn
Audited by Gen Agent Trust Hub on Aug 17, 2026
Risk Level: MEDIUMCOMMAND_EXECUTIONEXTERNAL_DOWNLOADSPROMPT_INJECTION
Full Analysis
- [DYNAMIC_EXECUTION]: The
PgVectorStore.searchmethod inresources/implementation-playbook.mdis vulnerable to SQL injection through unsafe string concatenation. - Evidence: The code constructs a SQL query by interpolating keys from the
filter_metadatadictionary directly into the string:f"metadata->>'{key}' = ${len(params)}". - Risk: If an application using this template allows untrusted input to influence the keys of the metadata filter, an attacker could execute arbitrary SQL commands to leak data or bypass security controls.
- [INDIRECT_PROMPT_INJECTION]: The skill's primary purpose is to facilitate Retrieval-Augmented Generation (RAG), which introduces a vulnerability surface for indirect prompt injection.
- Ingestion points: Untrusted data is retrieved from external vector databases via search methods in
resources/implementation-playbook.md(e.g.,PineconeVectorStore.search,QdrantVectorStore.search). - Boundary markers: Absent. The templates return raw strings and dictionary objects from the database without any delimiters or warnings to ignore embedded instructions.
- Capability inventory: The skill templates include network-based API calls to Pinecone, Qdrant, and Weaviate, as well as database operations for PostgreSQL.
- Sanitization: Absent. The provided implementation patterns do not include any logic to sanitize, escape, or validate retrieved content before it is likely used in a downstream LLM prompt.
- [UNVERIFIABLE_DEPENDENCIES_AND_REMOTE_CODE_EXECUTION]: The implementation playbook includes code that downloads external model assets at runtime.
- Evidence:
CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')in the_rerankmethod of thePineconeVectorStoreclass. - Source: Fetches model weights and configuration from Hugging Face, a well-known and established service for machine learning models.
Audit Metadata