Skip to content

MSC3013: Encrypted Push#3013

Closed
Sorunome wants to merge 12 commits into
matrix-org:old_masterfrom
Sorunome:soru/encrypted-push
Closed

MSC3013: Encrypted Push#3013
Sorunome wants to merge 12 commits into
matrix-org:old_masterfrom
Sorunome:soru/encrypted-push

Conversation

@Sorunome
Copy link
Copy Markdown
Contributor

@Sorunome Sorunome commented Feb 17, 2021

Comment thread proposals/3013-encrypted-push.md Outdated
Comment thread proposals/3013-encrypted-push.md Outdated
@anoadragon453 anoadragon453 added kind:feature MSC for not-core and not-maintenance stuff proposal A matrix spec change proposal proposal-in-review push labels Feb 17, 2021
Comment thread proposals/3013-encrypted-push.md Outdated
Comment thread proposals/3013-encrypted-push.md Outdated
Comment thread proposals/3013-encrypted-push.md
@flumeware
Copy link
Copy Markdown

Hi

1. Generate an ephemeral curve25519 key, and perform an ECDH with the ephemeral key and the backup's
   public key to generate a shared secret. The public half of the ephemeral key, encoded using unpadded
   base64, becomes the `ephemeral` property of the new payload.

Should backup's public key be pusher's public key?

Thanks

Comment thread proposals/3013-encrypted-push.md
@kegsay
Copy link
Copy Markdown
Member

kegsay commented Apr 3, 2021

MSC 3079: Low Bandwidth CS API may be an alternative to this as it makes it viable to rely on /sync for push notifications directly as it is made bandwidth efficient.

@Cadair
Copy link
Copy Markdown
Contributor

Cadair commented Apr 6, 2021

I think this and #3079 are likely to be complementary. If you are already using your platforms push provider running a permanent background process is still going to be more expensive than using the push provider, no matter how well optimised it is. #3979 with the extra work to add sync filters just for events which trigger push is a good solution to if you don't have (or don't want) and untrusted push provider.

@kegsay
Copy link
Copy Markdown
Member

kegsay commented Apr 7, 2021

Indeed, they can be complementary but at the cost of an increased API surface. If you don't trust your push provider, that has knock on concerns though. Malicious push providers can do more subtle attacks than just sniff the message (e.g delay the delivery) so the point the provider is untrusted then really you shouldn't be using it at all.

Comment thread proposals/3013-encrypted-push.md Outdated
Comment thread proposals/3013-encrypted-push.md
@turt2live turt2live added the needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. label Jun 8, 2021
@anoadragon453 anoadragon453 removed the needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. label Dec 7, 2021
@anoadragon453
Copy link
Copy Markdown
Member

Removing the needs-implementation label given the linked PRs.

@anoadragon453
Copy link
Copy Markdown
Member

Have put this in the "initial review" column on the SCT Backlog board to get eyes on it, though it may already be under the watchful purview of @dbkr. Feel free to take it off the board if you want to re-claim it Dave.

Copy link
Copy Markdown
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

This does add significant complexity (especially because it means Homeservers now have to do elliptic curve crypto too) but it does slot nicely into the gap for more secure (and/or more efficient) push in non-e2e rooms.

Would suggest the next step here is for someone with a crypto hat on to review the crypto side of it. It sounds like it would be quite heavyweight, equivalent to establishing a new megolm session per message?

Comment thread proposals/3013-encrypted-push.md Outdated
Comment thread proposals/3013-encrypted-push.md Outdated
Comment thread proposals/3013-encrypted-push.md Outdated
Comment on lines +76 to +77
This is the same algorithm used currently in the unstable spec for megolm backup, as such it is
comptible with libolms PkEncryption / PkDecryption methods.
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.

Note that we're now moving away from this though, towards symmetric encryption for key backup. It would also be good to have some words on why this encryption scheme was chosen & what cryptographic properties it gives (and doesn't give).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

as far as soru is aware the PkEncryption / PkDecryption was also used for asymmetric SSSS, and it seems like a good idea to have some go-to symmetric / asymmetric algorithms to use for the matrix world, though that is obviously beyond the scope of this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If you meant symmetric vs asymmetric cryptography, there is a paragraph on that under "Security considerations"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Another thing to note is that libolms PkEncryption / PkDecryption actually has a bug where it calculates the mac wrong (which soru discovered while working on encrypted push, uhoreg is aware about and said it is ok to talk about publicly as it only affects data integrity and not security itself), so until libolm gets fixed in that regard implementations need to do their own PkDecryption anyways

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See my comment about HPKE here: #3013 (comment).

Which will be used in MSC4388.

@richvdh richvdh mentioned this pull request Mar 17, 2026
@p1gp1g
Copy link
Copy Markdown

p1gp1g commented Mar 17, 2026

if we want to actually send message contents over push

To clarify a bit: the content of E2EE encrypted messages are E2EE with the protocol supported by matrix (Olm/Megolm/MLS potentially), we are talking about metadata only here

@tulir
Copy link
Copy Markdown
Member

tulir commented Mar 17, 2026

The goal of this MSC appears to be combining with #2782 to send full event content in pushes, not only metadata.

@p1gp1g
Copy link
Copy Markdown

p1gp1g commented Mar 17, 2026

In E2EE communications, the full content send via push notification is encrypted content and we only encrypt its metadata on top of that

# MSC3013: Encrypted Push

Push notifications have the problem that they typically go through third-party gateways in order to
be delivered, e.g. FCM (Google) or APNs (Apple) and an app-specific gateway (sygnal). In order to
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
be delivered, e.g. FCM (Google) or APNs (Apple) and an app-specific gateway (sygnal). In order to
be delivered, e.g. FCM (Google) or APNs (Apple) and an app-specific gateway (such as [Sygnal](https://github.com/element-hq/sygnal)). In order to

}
```

Now, when the homeserver pushes out the message, it is to perform the `notification` dict as with the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe it's just me but "perform" strikes me as slightly confusing here.

Suggested change
Now, when the homeserver pushes out the message, it is to perform the `notification` dict as with the
Now, when the homeserver pushes out the message, it is to construct the [`notification`](https://spec.matrix.org/v1.17/push-gateway-api/#post_matrixpushv1notify_request_notification) dict as with the

proper way to go here, as, in the case of the server being compromised, there is no need to re-negotiate
a new key to encrypt the push message.

## Unstable prefix
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you also need vendor prefixes for the various new properties such as public_key?

}
```

## Potential issues
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The maximum payload size on both APNS and FCM seems to be 4096 bytes which might be exceeded based on the size of the event contained in the notification. This is already a problem today when not using event_id_only but I assume it's somewhat aggravated here since encryption will increase the overall payload size?

The field `public_key` is required. This key is an unpadded base64-encoded curve25519
public key. This new field is not to be added to the actual push payload being sent to push gateways.

The field `counts_only_type` is an optional enum which denotes how push frames should handle counts-only
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's possibly just me but I'm finding the term "push frame" slightly irritating and I haven't met this terminology elsewhere yet. Can we not just say "push notification"?

@turt2live turt2live removed the unresolved-concerns This proposal has at least one outstanding concern label Mar 23, 2026
@richvdh
Copy link
Copy Markdown
Member

richvdh commented Mar 24, 2026

Proposing this for closure, since MSC4174 claims to replace it and is proposed for FCP. If anyone feels like this shouldn't be closed once MSC4174 is merged, please say so.

@mscbot fcp close

It's unclear that MSC4174 does fully replace this MSC; however this MSC appears to be without an owner and has some substantial concerns. So I'm going to leave the FCP close proposal in place.

@uhoreg
Copy link
Copy Markdown
Member

uhoreg commented Mar 24, 2026

I do not believe that MSC4174 replaces this, as we do not want to use the encryption scheme presented there with other push methods (which we are only accepting in MSC4174 because it comes as part of the Web Push bundle of standards and implementations). However, we also will want to use a different encryption scheme than what is currently presented here, and at this point, it's probably better to start with a new MSC when we're ready to define how to do that, so I agree with FCP closing at this point.

@ara4n
Copy link
Copy Markdown
Member

ara4n commented Apr 7, 2026

I believe that Gematik's TI-Messenger spec may use this (at least in the past): https://www.google.com/search?q=site%3Agematik.de+msc3013

Meanwhile, the actual concept (speed up sync by putting event payloads over APNS/FCM - but encrypt the payload to stop Apple/Google being able to see it) doesn't feel unreasonable.

As others have said, MSC4174 is not a direct replacement for this.

So, instead, I suggest we talk to Gematik first before unintentionally rugpulling stuff they consider important. I suggest we cancel the FCP close meanwhile.

@ara4n
Copy link
Copy Markdown
Member

ara4n commented Apr 7, 2026

@mscbot concern does TI-Messenger still depend on this? We don't want to close MSCs without a future plan for direction if folks have been building on them.

@mscbot mscbot added the unresolved-concerns This proposal has at least one outstanding concern label Apr 7, 2026
@richvdh
Copy link
Copy Markdown
Member

richvdh commented Apr 14, 2026

Gematik have confirmed out-of-band that TI-Messenger does not depend on this.

@mscbot resolve does TI-Messenger still depend on this? We don't want to close MSCs without a future plan for direction if folks have been building on them.

@mscbot mscbot removed the unresolved-concerns This proposal has at least one outstanding concern label Apr 14, 2026
@mscbot
Copy link
Copy Markdown
Collaborator

mscbot commented Apr 15, 2026

🔔 This is now entering its final comment period, as per the review above. 🔔

@mscbot mscbot added final-comment-period This MSC has entered a final comment period in interest to approval, postpone, or delete in 5 days. and removed proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. labels Apr 15, 2026
@turt2live turt2live removed the 00-weekly-pings Tracking for weekly pings in the SCT office. 00 to make it first in the labels list. label Apr 15, 2026
@turt2live turt2live moved this from Ready for FCP ticks to In FCP in Spec Core Team Workflow Apr 15, 2026
@mscbot
Copy link
Copy Markdown
Collaborator

mscbot commented Apr 20, 2026

The final comment period, with a disposition to close, as per the review above, is now complete.

@mscbot mscbot closed this Apr 20, 2026
@mscbot mscbot added finished-final-comment-period and removed disposition-close final-comment-period This MSC has entered a final comment period in interest to approval, postpone, or delete in 5 days. labels Apr 20, 2026
@turt2live turt2live added rejected A proposal which has been rejected for inclusion in the spec and removed finished-final-comment-period labels Apr 20, 2026
@turt2live turt2live moved this from In FCP to Merged/Done in Spec Core Team Workflow Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:feature MSC for not-core and not-maintenance stuff proposal A matrix spec change proposal push rejected A proposal which has been rejected for inclusion in the spec

Projects

Status: Merged/Done
Status: Scheduled - v1.8

Development

Successfully merging this pull request may close these issues.