-
Notifications
You must be signed in to change notification settings - Fork 433
MSC4174: Web push #4174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
MSC4174: Web push #4174
Changes from 40 commits
24473e5
2eae5a3
0346332
201ddc9
2f71bf3
1f5b73c
e413f9e
faa3101
216cf01
6bc8165
a9f7e48
c9d0b79
5ebd199
706e440
92ae561
1452aa8
8473849
55aeaf5
9b8ca9d
75b73c4
3874fe0
4b7642b
1d7dd7a
373dbc0
df81404
aee6877
9b41d6d
52ba762
9ee94eb
39e3687
3a37cec
8b376de
d2485a2
2561254
7f1849e
f3f96be
5bab3c4
83dc378
6b70438
f59cb97
bd30e72
246db23
8a67d56
becdd6e
5217c69
a3850f7
6d59575
7a00947
a31ae62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,176 @@ | ||||||
| # MSC4174: Web push | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [non-blocking] This MSC refers to the feature inconsistently as "WebPush" or "Web Push" (with or without the space), but it's hard to fault this MSC for that, since the RFCs do the same thing. However, when the spec gets written, we should pick one and stick with it. |
||||||
|
|
||||||
| This MSC supersedes and replaces [MSC3013](https://github.com/matrix-org/matrix-spec-proposals/pull/3013), which introduced push notification encryption first. | ||||||
|
Member
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that we only want to use the encryption defined in here for WebPush (and only because it isn't easy to replace the encryption in WebPush with something else). If we want to encrypt push notifictions over other systems, we should use a different mechanism, which will probably be something different from what 3013 defines. So 3013 will be probably replaced, but not by this MSC. Basically, this first sentence should be removed.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cf. #3013 (comment) |
||||||
|
|
||||||
| Push notifications typically go through third-party push providers in order to be delivered: 1) a push gateway (sygnal) and | ||||||
| 2) e.g. FCM (Google) or APNs (Apple). In order to prevent these push providers and | ||||||
| push gateways from being able to read any sensitive information, the `event_id_only` format was introduced, where the push content only contains the `event_id` and `room_id` of an event. After receiving the push message the client uses | ||||||
| `GET /_matrix/client/r0/rooms/{roomId}/event/{eventId}` to fetch the full event itself, and creates the notification based | ||||||
| on that. | ||||||
|
|
||||||
| Leaking the room and event id to third parties is problematic and can be avoided. | ||||||
|
|
||||||
| Today, web clients supporting push notifications (eg. hydrogen) needs to use a matrix to webpush gateway. This requires | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| going over the specifications, because they use `endpoint`, and `auth` in the `PusherData` ([hydrogen](https://github.com/element-hq/hydrogen-web/blob/9b68f30aad329c003ead70ff43f289e293efb8e0/src/platform/web/dom/NotificationService.js#L32), [sygnal](https://github.com/matrix-org/sygnal/blob/main/sygnal/webpushpushkin.py#L152)), | ||||||
| while [the current specifications let understand that only `url` and `format` are allowed](https://spec.matrix.org/v1.9/client-server-api/#_matrixclientv3pushers_pusherdata). | ||||||
| The specifications already need to be adapted to follow what the web clients do. | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| Web Push is a standard for (E2EE) push notifications, defined with 3 RFC: | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - [RFC8030](https://www.rfc-editor.org/rfc/rfc8030) defines the application server to push server communications | ||||||
| - [RFC8291](https://www.rfc-editor.org/rfc/rfc8291) defines the encryption: | ||||||
| - the subscribing client (user agent in RFC8030) generates a P-256 key pair the *auth* secret, and sends the P-256 public key and the *auth* secret to the home server during registration | ||||||
|
||||||
| - the home server encrypts outgoing push notifications with the client keys | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - the notifications are then decrypted by the subscribing client | ||||||
| - [RFC8292](https://www.rfc-editor.org/rfc/rfc8292): defines the authorization: | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - it is supposed to be *Voluntary* (optional) but many big push servers require it | ||||||
| - the home server generates a single P-256 key pair, and any client get request the public key | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - the client passes the VAPID public key while requesting a new registration to their push server | ||||||
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| - the push server is then able to allow only requests, with an authorization header signed with the VAPID key | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - the home server adds the authorization header to all push notifications | ||||||
|
|
||||||
| Many libraries are already available and robust: they are reviewed, and acknowledge by experts. | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| Extending the push kind to [`POST /_matrix/client/v3/pushers/set`](https://spec.matrix.org/v1.16/client-server-api/#post_matrixclientv3pushersset) to a `*webpush*` would provide encrypted push notifications without the need for an external gateway to | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - Web app and desktop app | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - Android apps using [UnifiedPush](https://codeberg.org/UnifiedPush/specifications/src/branch/main/specifications/android.md#resources). This MSC would make [MSC2970](https://github.com/matrix-org/matrix-spec-proposals/pull/2970) redundant. | ||||||
| - Android apps using FCM ([It is possible to push to FCM with webpush standard](https://unifiedpush.org/news/20250131_push_for_decentralized/)) | ||||||
| - Maybe other ? We have seen [apple moving a lot into web push support](https://developer.apple.com/documentation/usernotifications/sending-web-push-notifications-in-web-apps-and-browsers) | ||||||
anoadragon453 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| ## Proposal | ||||||
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| The MSC introduces a new push kind: webpush. | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| `PusherData` is extended as follows: | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - `format`: is updated to be required if `kind` is `http` or `webpush` | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - `url`: is updated to be required if `kind` is `http`, or if `kind` is `webpush`. If `kind` is `webpush`, this is the URL defined as a `push resource` by RFC8030. MUST be an HTTPS URL. | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - `auth`: is introduced, required if `kind` is `webpush`, not used otherwise. This holds the authentication secret as | ||||||
| specified by RFC8291 - 16 random bytes encoded in URL-safe Base64 without padding. | ||||||
|
||||||
|
|
||||||
| `PusherData` also get new field, `activated`, a boolean, that must not be set by the client and the server must add to the responses that include the data. During a first registration, or during a re-registration where the Pusher `pushkey`, `PusherData.url` or `PusherData.auth` is updated, `activated` is set to false until the pusher is activated with the request to | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| `/_matrix/client/v3/pushers/ack`i (cf. bellow). Re-subscribing an existing pusher, with the same `pushkey`, `PusherData.url` and `PusherData.auth` doesn't change its value. | ||||||
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| `/_matrix/client/v3/pushers/ack`i (cf. bellow). Re-subscribing an existing pusher, with the same `pushkey`, `PusherData.url` and `PusherData.auth` doesn't change its value. | |
| `/_matrix/client/v3/pushers/ack` (cf. below). Re-subscribing an existing pusher, with the same `pushkey`, `PusherData.url` and `PusherData.auth` doesn't change its value. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention here that the pushkey is still a unique identifier for the pusher (as it is currently defined in the spec), and is also the public key? In other words, the client needs to use a unique P-256 key per pusher? If so, I think this should be stated explicity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec isn't very clear for FCM/APNS push key too
uhoreg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, what is a VAPID key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RFC8292
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced 410 is appropriate here. I'd just use 400 if there is no particular reason for 410.
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is enabled necessary here, or is the presence of an m.webpush entry sufficient for clients to determine that their server supports webpush?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I slightly feel that it might be more appropriate to expose this on a separate endpoint, but it's not a strong opinion.
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
p1gp1g marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the client already uses the PusherData that way.
I don't understand what this means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hydrogen already uses pushkey for the p-256 pubkey
p1gp1g marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the sample implementation follow these recommendations? Do they work ok in practice (especially not following redirects)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MatMaul may answer that question
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the capabilities? There doesn't seem much point specifying an unstable prefix for that without also doing so for Pusher.kind and the new API endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MatMaul any opinion ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation requirements:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@turt2live These requirements are now met
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client (Hydrogen) and Server (Synapse) implementations noted at #4174 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This MSC has changed since the implementations were made. I'm not sure what all the changes were. If they are primarily minor changes such as naming changes (e.g. renaming properties), or changes of that sort, then the implementations should still be fine as a demonstration that the MSC works. If there are any substantial changes, then the implementations may need to be updated.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The homeserver implementation for Synapse is actively being updated in element-hq/synapse#17987. It has yet to be merged.
The client implementation for Hydrogen has not been updated since Dec 2nd, 2024: element-hq/hydrogen-web#1201. The changes to the MSC since Dec 2nd, 2024 are https://github.com/matrix-org/matrix-spec-proposals/pull/4174/files/0346332a1f802425b579d2b4cdf98fe8a462d48b..f59cb97551216812d1ca492fafba05d057cc1298.
I've left a review on the Hydrogen PR with what appears to be missing from a cursory glance. As such, I think we're still missing an up-to-date client implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mscbot concern The client implementation has grown stale with respect to the MSC. See this PR review for the outstanding changes.