Skip to content

Commit

Permalink
fix(errors): Handle null bytes in search and fingerprints (#25344)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
neilkakkar and github-actions[bot] authored Oct 3, 2024
1 parent 33d2803 commit 63b6c8f
Show file tree
Hide file tree
Showing 3 changed files with 443 additions and 58 deletions.
6 changes: 5 additions & 1 deletion posthog/hogql_queries/error_tracking_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,12 @@ def extracted_fingerprint_property(self):
@cached_property
def error_tracking_groups(self):
queryset = ErrorTrackingGroup.objects.filter(team=self.team)
# :TRICKY: Ideally we'd have no null characters in the fingerprint, but if something made it into the pipeline with null characters
# (because rest of the system supports it), try cleaning it up here. Make sure this cleaning is consistent with the rest of the system.
# This does mean we'll not match with this ErrorTrackingGroup
cleaned_fingerprint = [part.replace("\x00", "\ufffd") for part in self.query.fingerprint or []]
queryset = (
queryset.filter(fingerprint=self.query.fingerprint)
queryset.filter(fingerprint=cleaned_fingerprint)
if self.query.fingerprint
else queryset.filter(status__in=[ErrorTrackingGroup.Status.ACTIVE])
)
Expand Down
Loading

0 comments on commit 63b6c8f

Please sign in to comment.