matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.83k stars 2.12k forks source link

`prune_event` strips keys needed for authentication from events. #1831

Open NegativeMjark opened 7 years ago

NegativeMjark commented 7 years ago

It looks like we've been using keys in the event authentication checks without making sure they won't be removed when an event is redacted:

https://github.com/matrix-org/synapse/blob/v0.18.7/synapse/events/utils.py#L41-L57 https://github.com/matrix-org/synapse/blob/v0.18.7/synapse/events/utils.py#L69 https://github.com/matrix-org/synapse/blob/v0.18.7/synapse/events/utils.py#L71

Unfortunately fixing this will break the event signature checks for those events.

richvdh commented 2 years ago

I think this will be fixed by https://github.com/matrix-org/synapse/pull/8984, if/when it ever makes it into a production room version.

babolivier commented 2 years ago

I think this will be fixed by https://github.com/matrix-org/synapse/pull/8984, if/when it ever makes it into a production room version.

It looks like that PR/MSC only fixes things for the redacts key, not third_party_invite or m.federate.

richvdh commented 2 years ago

mmm, true

richvdh commented 2 years ago

as https://github.com/matrix-org/matrix-spec-proposals/pull/2176#issuecomment-529584094 says, MSC2176 doesn't fix third_party_invite.

8984 does fix m.federate: https://github.com/matrix-org/synapse/pull/8984/files#diff-cd497404c31b1cbaa0bcc442a4c10f1151d151c01e1208e40aede55635e9ab8eR103.

turt2live commented 2 years ago

I've started an MSC2176 2.0 to handle third_party_invite and whatever else we notice: https://github.com/matrix-org/matrix-spec-proposals/pull/3821

clokep commented 1 year ago

I've started an MSC2176 2.0 to handle third_party_invite and whatever else we notice: matrix-org/matrix-spec-proposals#3821

Note that #15563 implements MSC3821. So (assuming the MSC is accepted) we should be able to close this when that's released in a room version.