hybrid-search-implementation
Warn
Audited by Gen Agent Trust Hub on Oct 7, 2026
Risk Level: MEDIUMDYNAMIC_EXECUTIONINDIRECT_PROMPT_INJECTION
Full Analysis
- [DYNAMIC_EXECUTION]: The Python implementation for PostgreSQL in
resources/implementation-playbook.mdcontains a SQL injection vulnerability. Specifically, thehybrid_searchmethod in thePostgresHybridSearchclass constructs a SQLWHEREclause by directly interpolating dictionary keys from thefilter_metadataargument into a query string using f-strings (metadata->>'{key}'). If these keys are derived from user-controlled input, an attacker could execute arbitrary SQL commands by supplying malicious key names. - [INDIRECT_PROMPT_INJECTION]: The skill facilitates the creation of Retrieval-Augmented Generation (RAG) pipelines, which are inherently vulnerable to indirect prompt injection. Malicious instructions embedded in the documents stored in PostgreSQL or Elasticsearch could be retrieved and processed by the agent, leading to unauthorized behavior.
- Ingestion points: Untrusted content is ingested from the
documentstable and search indexes referenced inresources/implementation-playbook.md. - Boundary markers: The provided code templates do not include delimiters or specific instructions to the agent to ignore content within retrieved data.
- Capability inventory: The skill enables database queries and interactions with search engine APIs.
- Sanitization: The SQL construction logic fails to sanitize or validate metadata keys before inclusion in the query.
Audit Metadata