Description
Currently the private data in a Zulip push notification (sender, stream name, message body) is encrypted over the wire, but handled in plaintext within the Zulip notification forwarder and the Apple or Google notification service.
This is consistent with standard practice until at least last year; but last October Apple introduced in iOS 10 a way to have the app's code run to adjust a received notification, which opens the option of encrypting the data all the way to the app. That'd be neat, and doubly so because for a Zulip server other than zulipchat.com, there are two third parties involved in handling the notification: Apple or Google, and Kandra Labs.
Quoting my comment at zulip/zulip#6364 (comment) (on a PR specifically about iOS):
"""
A bit of web searching tells me that as of 2016 (and iOS 10), there is actually a way to have your app's code invoked when a notification is delivered! Docs here: https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension
It's not well documented. The APNs payload reference @kunall17 linked above doesn't mention the relevant key, and claims that all keys not mentioned "are ignored by Apple". I'm a little dubious of how well-supported it will be, like whether the OS will reliably actually call the extension and how much time it'll give the extension to run. As part of Apple's obsession with battery life for iOS, they've always been stingy with every form of background processing for apps, which is why push notifications without this API have always been self-contained data that the OS would interpret without consulting the app.
I think my inclination would be:
- For now, just include the message content like every other app that includes content in notifications must have been doing until last October.
- Later, improve on that to keep the data encrypted end-to-end from the Zulip server to the device -- but by including it in the message, encrypted with a key the app has previously exchanged with the server, so that no network fetch is required. That won't make it for 1.7, but I think a natural way of engineering it will allow it to work for any given user as soon as both their client app and their server run a version that supports it.
"""
I believe something similar is also possible for Android, though I haven't read up on it.