# GHSA-96P7-33VC-XGF2: Agenta: SQL injection in tracing full-text content filter

- Database: GitHub
- Severity: high (stated by ghsa, no CVSS score)
- Published: 2026-12-03
- Modified: 2026-12-03

## Tracked as

- [CVE-2026-142652](https://cve.now/CVE-2026-142652.md): Agenta: SQL injection in tracing full-text content filter

## Affected versions

- agenta (PyPI): fixed in 0.122.5

## Description

### Impact

The full-text `content` filter used by the span query endpoint (`POST /api/spans/query`) inserted the user-supplied search term into the SQL query without parameter binding or escaping. A single quote in the search term ends the SQL string literal, and the rest of the term runs as SQL.

Any authenticated user who can view spans in their own project can send this filter. The query runs against the tracing database, so an attacker can read tracing data from every project and every tenant, including other tenants' traces and spans. The attacker reads the data blind, for example through boolean or timing conditions.

The tracing data is stored in a separate Postgres database. Users, API keys and secrets are stored in a different database, and this query cannot reach them.

### Affected code

`api/oss/src/dbs/postgres/tracing/utils.py`, function `_handle_fts_field`.

### Patches

The issue is fixed in version 0.122.5. The search term is now passed to `websearch_to_tsquery` as a bound query parameter. A regression test covers quoted and SQL-like search terms.

### Workarounds

There is no workaround. Upgrade to 0.122.5 or later. Self-hosted operators can reduce the impact by running the API with a database role that is not a superuser and that has access only to the Agenta databases.

### Credits

Reported by Lee Zhi Yang ([@Xeraaaaaaa](https://github.com/Xeraaaaaaa)).

## References

- https://github.com/Agenta-AI/agenta/security/advisories/GHSA-96p7-33vc-xgf2
- https://github.com/Agenta-AI/agenta/pull/7529
- https://github.com/Agenta-AI/agenta/commit/345d6d3e22bc0ece92ebefdf11d8e453c658e51c
- https://github.com/Agenta-AI/agenta
- https://github.com/Agenta-AI/agenta/releases/tag/v0.122.5

Page: https://cve.now/GHSA-96P7-33VC-XGF2

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
