hybrid-search-implementation

Warn

Audited by Gen Agent Trust Hub on Sep 26, 2026

Risk Level: MEDIUMCOMMAND_EXECUTIONDYNAMIC_EXECUTIONINDIRECT_PROMPT_INJECTIONEXTERNAL_DOWNLOADS
Full Analysis
  • [COMMAND_EXECUTION]: The PostgresHybridSearch.hybrid_search method in SKILL.md is vulnerable to SQL injection. The implementation uses f-string interpolation to insert dictionary keys directly into a SQL query string (metadata->>'{key}'). If these keys are influenced by untrusted external input, an attacker could manipulate the query structure to bypass filters or access unauthorized records.
  • [DYNAMIC_EXECUTION]: The ElasticsearchHybridSearch.hybrid_search template in SKILL.md performs dynamic script generation. It interpolates the boost_vector variable directly into an Elasticsearch Painless script. Without strict validation ensuring these variables are numeric, this pattern allows for script injection within the search engine's execution environment.
  • [INDIRECT_PROMPT_INJECTION]: The skill provides a HybridRAGPipeline structure that is susceptible to indirect prompt injection attacks where malicious instructions in indexed data could influence the agent.
  • Ingestion points: The pipeline ingests untrusted content from external vector and keyword stores in the _vector_search and _keyword_search methods in SKILL.md.
  • Boundary markers: The implementation lacks delimiters (e.g., XML tags) or specific instructions to the model to ignore embedded commands within the retrieved search results.
  • Capability inventory: The pipeline includes database querying and neural reranking capabilities.
  • Sanitization: No sanitization, escaping, or validation logic is applied to the retrieved content before it is passed to the reranker or potential downstream agent components.
  • [DYNAMIC_EXECUTION]: The search_with_rerank method in SKILL.md downloads and initializes a sentence_transformers reranking model. While the model is fetched from a well-known and trusted service (Hugging Face), the process involves loading remote model weights at runtime.
  • [EXTERNAL_DOWNLOADS]: The skill fetches a pre-trained reranking model (cross-encoder/ms-marco-MiniLM-L-6-v2) from Hugging Face's official repository during the reranking step.
Audit Metadata
Risk Level
MEDIUM
Analyzed
Sep 26, 2026, 11:53 AM