Skip to content

fix: parameterize metadata filter keys in AsyncPostgresVectorStore - #224

Merged
dishaprakash merged 4 commits into
mainfrom
vul-fix
Oct 13, 2026
Merged

dishaprakash merged 4 commits into
mainfrom
vul-fix

Conversation

@dishaprakash

Copy link
Copy Markdown
Contributor

Summary

  • Parameterizes JSON metadata filter keys in AsyncPostgresVectorStore.__to_postgres_key using bind_params (li_metadata->>:key_n) instead of direct f-string interpolation to prevent SQL injection via MetadataFilter.key.
  • Quotes known physical column identifiers in __to_postgres_key.
  • Uses json.dumps when serializing scalar filter values for FilterOperator.CONTAINS in __parse_metadata_filter.
  • Adds a unit test verifying that both MetadataFilter.key and MetadataFilter.value are bound as query parameters.

@dishaprakash
dishaprakash requested review from a team as code owners October 12, 2026 14:41
@product-auto-label product-auto-label Bot added the api: cloudsql-postgres Issues related to the googleapis/llama-index-cloud-sql-pg-python API. label Oct 12, 2026
@dishaprakash
dishaprakash merged commit e517fe5 into main Oct 13, 2026
17 checks passed
@dishaprakash
dishaprakash deleted the vul-fix branch October 13, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: cloudsql-postgres Issues related to the googleapis/llama-index-cloud-sql-pg-python API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants