fix(ai-conversations): Escape conversation IDs in query strings#112455
Merged
vgrozdanic merged 1 commit intomasterfrom Apr 8, 2026
Merged
fix(ai-conversations): Escape conversation IDs in query strings#112455vgrozdanic merged 1 commit intomasterfrom
vgrozdanic merged 1 commit intomasterfrom
Conversation
Conversation IDs were interpolated directly into search query strings without escaping. Values containing special characters like parentheses (e.g. `UUID(xxx)`) would be misinterpreted by the search parser, breaking queries. This also prevented stored injection where a malicious conversation ID from Snuba results could modify subsequent query logic. Use `build_escaped_term_filter` to properly quote and escape values. Co-Authored-By: Claude <[email protected]>
shellmayr
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Conversation IDs were interpolated directly into search query strings
without escaping in both the AI conversations list and details endpoints.
Values containing special characters like parentheses (e.g.
UUID(xxx))would be misinterpreted by the search parser, breaking queries entirely.
More critically, this was a stored injection vector: conversation IDs
returned from Snuba results were used unescaped in subsequent queries
(aggregations, enrichment, first/last IO). A malicious conversation ID
value like
foo OR user.email:*stored in ClickHouse could modify thequery logic and potentially leak data across conversations.
Uses the existing
build_escaped_term_filterutility fromsentry.search.eap.occurrences.query_utilswhich properly double-quotesvalues and escapes backslashes and quotes within them.