Skip to content

MSC4174: Web push#4174

Open
p1gp1g wants to merge 49 commits intomatrix-org:mainfrom
p1gp1g:webpush-pushkind
Open

MSC4174: Web push#4174
p1gp1g wants to merge 49 commits intomatrix-org:mainfrom
p1gp1g:webpush-pushkind

Conversation

@p1gp1g
Copy link
Copy Markdown

@p1gp1g p1gp1g commented Aug 1, 2024

rendered

Client implementation:
synapse impl: element-hq/synapse#17987
updated hydrogen impl: element-hq/hydrogen-web#1201

Note: in addition to this MSC, it would be very useful to have MSC4173, if someone is interested in implementing this MSC as well


SCT Stuff:

MSC checklist

FCP tickyboxes

@p1gp1g p1gp1g force-pushed the webpush-pushkind branch from 0f3f077 to 6ccf76d Compare August 1, 2024 15:53
@p1gp1g p1gp1g force-pushed the webpush-pushkind branch from 6ccf76d to 24473e5 Compare August 1, 2024 15:54
@p1gp1g p1gp1g changed the title MSC webpush push kind MSC4174: webpush push kind Aug 1, 2024
@turt2live turt2live added push proposal A matrix spec change proposal client-server Client-Server API needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Aug 1, 2024
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client
  • Server

Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown
Member

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)

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

@anoadragon453 anoadragon453 Mar 11, 2026

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.

Copy link
Copy Markdown
Member

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.

@p1gp1g
Copy link
Copy Markdown
Author

p1gp1g commented Aug 7, 2024

Thank you for your feedback @clokep, I'm updated the proposal soon

Reword some sentences, add links
@p1gp1g
Copy link
Copy Markdown
Author

p1gp1g commented Nov 21, 2024

Client implementation: p1gp1g/hydrogen-web@e7cc488

@MatMaul
Copy link
Copy Markdown

MatMaul commented Dec 2, 2024

synapse impl: element-hq/synapse#17987
updated hydrogen impl: element-hq/hydrogen-web#1201

@uhoreg uhoreg added implementation-needs-checking The MSC has an implementation, but the SCT has not yet checked it. and removed needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Dec 13, 2024
@tulir
Copy link
Copy Markdown
Member

tulir commented Jan 21, 2025

Implementations seem to implement what's described in the MSC, so removing the needs-checking label

@mscbot mscbot added unresolved-concerns This proposal has at least one outstanding concern and removed unresolved-concerns This proposal has at least one outstanding concern labels Mar 11, 2026
Copy link
Copy Markdown
Member

@anoadragon453 anoadragon453 Mar 11, 2026

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.

@anoadragon453 anoadragon453 added the needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. label Mar 11, 2026
p1gp1g and others added 2 commits March 12, 2026 09:45
@@ -0,0 +1,177 @@
# MSC4174: Web push

This MSC supersedes and replaces [MSC3013](https://github.com/matrix-org/matrix-spec-proposals/pull/3013), which introduced push notification encryption first.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tulir claims this MSC does not adequately replace MSC3013.

@mscbot concern decide if we are replacing MSC3013 or not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`POST /_matrix/client/v3/pushers/set` now supports a new `kind`: `webpush`.
- `kind`: is updated to introduce `webpush` which makes a
pusher that sends Web Push encrypted messages.
- `pushkey`: is updated, if the `kind` is `webpush`, this is the user agent public key in the uncompressed form ([SEC 1](https://www.secg.org/sec1-v2.pdf), section 2.3.3, replicated from X9.62), encoded in URL-safe Base64 without padding. The public key comes from a ECDH
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Author

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

@@ -0,0 +1,177 @@
# MSC4174: Web push
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Web Push is a standard for (E2EE) push notifications, defined with 3 RFC:
- [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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the auth secret and P-256 key pair different things?

(Also, why is auth in italics?)

```
"m.webpush": {
"enabled": true,
"vapid": "BNbXV88MfMI0fSxB7cDngopoviZRTbxIS0qSS-O7BZCtG04khMOn-PP2ueb_X7Aeci42n02kJ0-JJJ0uQ4ELRTs"
Copy link
Copy Markdown
Member

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.


```
"m.webpush": {
"enabled": true,
Copy link
Copy Markdown
Member

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?

safelist a private IP. (Synapse already implements [`ip_range_whitelist`](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#ip_range_whitelist))
It is also recommended to not follow redirection, to avoid implementation issue where the destination is checked
before sending the request but not for redirection.

Copy link
Copy Markdown
Member

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)?

Copy link
Copy Markdown
Author

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

Comment on lines +172 to +173
- Until this proposal is considered stable, implementations must use
`org.matrix.msc4174.webpush` instead of `m.webpush`.
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MatMaul any opinion ?

@p1gp1g
Copy link
Copy Markdown
Author

p1gp1g commented Mar 18, 2026

RE: P-256 concern (can't find the comment anymore)

RFC8291, web push AES-128-GCM encryption: the key is derived from the auth_secret and the ECDH secret. If somehow the P-256 curve is broken, you will still have to break the auth_secret too. And if the notification contains the content of the event, the content is encrypted with Olm/Megolm on top of that

I think we should start working with the IETF to make a new AES-256-GCM encryption for web push, that works the same way, maybe using X25519 at the same time; using a 32B pre-shared key as auth_secret would make the protocol PQ. It is more efficient than all application rolling their own protocol again

@poljar
Copy link
Copy Markdown
Contributor

poljar commented Mar 18, 2026

I think we should start working with the IETF to make a new AES-256-GCM encryption for web push, that works the same way, maybe using X25519 at the same time; using a 32B pre-shared key as auth_secret would make the protocol PQ. It is more efficient than all application rolling their own protocol again

I would say that this is a good idea, though I would suggest that we attempt to reuse HPKE and its single shot API if such an attempt is mounted.

HPKE also has some drafts around which add PQ-safe algorithms to the mix.

@p1gp1g
Copy link
Copy Markdown
Author

p1gp1g commented Mar 18, 2026

I think we should start working with the IETF [...]

I would say that this is a good idea, though I would suggest that we attempt to reuse HPKE and its single shot API is such an attempt is mounted.

HPKE also has some drafts around which add PQ-safe algorithms to the mix.

There should be different way to do it, and would be discussed with IETF. The limited size of push notifications is important, so the pre-shared key solution may be a good thing. I'm surprised they offer AES-128, I thought it wasn't considered PQ-safe

Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Hubert Chathi <[email protected]>
Co-authored-by: S1m <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00-weekly-pings Tracking for weekly pings in the SCT office. 00 to make it first in the labels list. client-server Client-Server API disposition-merge kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. push unresolved-concerns This proposal has at least one outstanding concern

Projects

Status: Ready for FCP ticks

Development

Successfully merging this pull request may close these issues.