hybrid-search-implementation

Pass

Audited by Gen Agent Trust Hub on Sep 21, 2026

Risk Level: SAFECOMMAND_EXECUTIONINDIRECT_PROMPT_INJECTION
Full Analysis
  • [COMMAND_EXECUTION]: The PostgresHybridSearch.hybrid_search method in resources/implementation-playbook.md contains a SQL injection vulnerability during query construction.
  • Evidence: The implementation iterates through filter_metadata and interpolates keys directly into the SQL string: where_clause += f" AND metadata->>'{key}' = ${len(params)}". If the keys in the metadata dictionary are derived from untrusted user input, an attacker could manipulate the SQL query structure.
  • [INDIRECT_PROMPT_INJECTION]: The HybridRAGPipeline and reranking templates in resources/implementation-playbook.md represent an attack surface for indirect prompt injection.
  • Ingestion points: _vector_search and _keyword_search methods in HybridRAGPipeline fetch external data.
  • Boundary markers: The templates do not demonstrate the use of delimiters or 'ignore' instructions for the retrieved content.
  • Capability inventory: The pipeline performs database operations and neural model inference (reranking).
  • Sanitization: No sanitization or validation of the retrieved document content (SearchResult.content) is performed before it is passed to the reranker or potentially a downstream LLM.
Audit Metadata
Risk Level
SAFE
Analyzed
Sep 21, 2026, 05:05 PM