matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
164 stars 147 forks source link

Truncate large values inside of Firebase notification body fields. #386

Closed devonh closed 3 months ago

devonh commented 3 months ago

This PR changes the use of the Firebase v1 API to truncate the content fields within data to a maximum length.

NOTE: The existing code for the legacy API does not effectively truncate content since it relies on len(data[attr]) > MAX_BYTES_PER_FIELD which will return the number of keys inside the content dict. Since the legacy API is being removed tomorrow, I don't want to spend time coming up with a solution for this. At first glance it appears to be more involved than I would like to accurately count the size in bytes of the contents of the values inside of a python dict.