Skip to content
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

Spec does not specify how to handle duplicate auth events #903

Closed
richvdh opened this issue Oct 6, 2021 · 3 comments
Closed

Spec does not specify how to handle duplicate auth events #903

richvdh opened this issue Oct 6, 2021 · 3 comments
Labels
A-S2S Server-to-Server API (federation) enhancement A suggestion for a relatively simple improvement to the protocol

Comments

@richvdh
Copy link
Member

richvdh commented Oct 6, 2021

Suppose you receive an event over federation whose auth_events include two m.room.member events for the sender. One of those events is a join, and one is a leave. Should we accept the event or not?

I think the answer is probably "if the auth_events specify multiple events with the same (type, state_key), the event should be rejected", but the spec doesn't say that, and it's not what Synapse currently does.

@richvdh richvdh added enhancement A suggestion for a relatively simple improvement to the protocol A-S2S Server-to-Server API (federation) labels Oct 6, 2021
@richvdh
Copy link
Member Author

richvdh commented Oct 6, 2021

this is probably part of https://github.com/matrix-org/matrix-doc/issues/1646

@erikjohnston
Copy link
Member

I'm sure we've talked in the past that we might want to enforce that the auth_events field should only include event types that are expected, I think maybe as part of our work in reducing sizes of events or something? I'm failing to find it though, so I'm more mentioning this in the hopes it jogs someone else's memory...

@richvdh richvdh transferred this issue from matrix-org/matrix-spec-proposals Mar 2, 2022
@richvdh
Copy link
Member Author

richvdh commented Jun 8, 2022

I think the answer is probably "if the auth_events specify multiple events with the same (type, state_key), the event should be rejected", but the spec doesn't say that, and it's not what Synapse currently does.

This is incorrect; the spec says exactly that and has done since matrix-org/matrix-spec-proposals#1594. From https://spec.matrix.org/v1.2/rooms/v9/#authorization-rules:

  1. Reject if event has auth_events that:
    1. have duplicate entries for a given type and state_key pair
    2. have entries whose type and state_key don’t match those specified by the auth events selection algorithm described in the server specification.

@richvdh richvdh closed this as completed Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-S2S Server-to-Server API (federation) enhancement A suggestion for a relatively simple improvement to the protocol
Projects
None yet
Development

No branches or pull requests

2 participants