-
Notifications
You must be signed in to change notification settings - Fork 386
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
MSC1693: Specify how to handle rejected events in new state res #1693
Changes from 21 commits
3d3b77e
4790432
4df346a
40d943f
25fb09b
1f1ba28
a6aab37
b8a8d13
a80ff2f
6c9a433
eaaf36e
c581c61
539ca4c
f064554
612d8a6
7782781
8a3e7b7
a8bd2f3
bc9d205
b695eb0
463c71a
48d271e
39f7c77
8fb2bd2
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# State Resolution: Reloaded | ||
- **Author**: Erik Johnston | ||
- **Created**: 2018-07-20 | ||
- **Updated**: | ||
- #1693: Clarify how to handle rejected events ─ Erik Johnston, 2018-10-30 | ||
|
||
|
||
|
||
# State Resolution: Reloaded | ||
|
||
Thoughts on the next iteration of the state resolution algorithm that aims to | ||
mitigate currently known attacks | ||
|
@@ -47,7 +53,7 @@ which can be summarized into two separate cases: | |
|
||
1. Moderation evasion ─ where an attacker can avoid e.g. bans by forking and | ||
joining the room DAG in particular ways. | ||
1. State resets ─ where a server (often innocently) sends an event that points | ||
2. State resets ─ where a server (often innocently) sends an event that points | ||
to disparate parts of the graph, causing state resolution to pick old state | ||
rather than later versions. | ||
|
||
|
@@ -279,8 +285,8 @@ First we define: | |
events, the auth check algorithm is applied to each event in turn. The state | ||
events used to auth are built up from previous events that passed the auth | ||
checks, starting from a base set of state. If a required auth key doesn't | ||
exist in the state, then the one in the event's auth_events is used. (See | ||
_Variations_ and _Attack Vectors_ below). | ||
exist in the state, then the one in the event's auth_events is used if the | ||
auth event is not rejected. (See _Variations_ and _Attack Vectors_ below). | ||
|
||
The algorithm proceeds as follows: | ||
|
||
|
@@ -436,6 +442,42 @@ a separate auth chain, and the difficulties that entails (like having to | |
reapply the unconflicted state at the end). | ||
|
||
|
||
### Rejected Events | ||
|
||
Events that have been rejected due to failing auth based on the state at the | ||
event (rather than based on their auth chain) are handled as usual by the | ||
algorithm, unless otherwise specified. | ||
|
||
Note that no events rejected due to failure to auth against their auth chain | ||
should appear in the process, as they should not appear in state (and the | ||
algorithm only uses events in one of the state sets or their auth events). | ||
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'm failing to parse "or their auth events". it's unclear if 'their' refers to the rejected events, or the events in one of the state sets. i assume it's meant to be:
perhaps? 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've rejigged it a bit, but I meant the latter. Hope its clearer now |
||
|
||
This helps ensure that different servers' view of state is more likely to | ||
converge, since rejection state of an event may be different. This can happen if | ||
a third server gives an incorrect version of the state when a server joins a | ||
room via it (either due to being faulty or malicious). Convergence of state is a | ||
desirable property as it ensures that all users in the room have a (mostly) | ||
consistent view of the state of the room. If the view of the state on different | ||
servers diverges it can lead to bifurcation of the room due to e.g. servers | ||
disagreeing on who is in the room. | ||
|
||
Intuitively using rejected events feels dangerous, however: | ||
erikjohnston marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. Servers cannot arbitrarily make up state, since they still need to pass the | ||
auth checks based on the event's auth chain (e.g. they can't grant themselves | ||
power levels if they didn't have them before). | ||
2. For a previously rejected event to pass auth there must be a set of state | ||
that allows said event. A malicious server could therefore produce a | ||
fork where it claims the state is that particular set of state, duplicate the | ||
rejected event to point to that fork, and send the event. The | ||
duplicated event would then pass the auth checks. Ignoring rejected events would therefore not | ||
eliminate any potential attack vectors. | ||
|
||
Rejected auth events are deliberately excluded from use in the iterative auth checks, as | ||
auth events aren't re-authed during the iterative auth checks (although non-auth events are.) | ||
list. | ||
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. There's something with the end of this sentence. Probably, it should've been "auth events arent' re-authed (although non-auth events are) during the iterative auth checks"? 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. Ta, will have a look 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. looks like |
||
|
||
|
||
### Attack Vectors | ||
|
||
The main potential attack vector that needs to be considered is in the | ||
|
@@ -446,6 +488,12 @@ event. | |
|
||
# Appendix | ||
|
||
The following are some worked examples to illustrate some of the mechanisms in | ||
the algorithm. In each we're interested in what happens to the topic. | ||
|
||
|
||
## Example 1 - Mainline | ||
|
||
The following is an example room DAG, where time flows down the page. We shall | ||
work through resolving the state at both _Message 2_ and _Message 3_. | ||
|
||
|
@@ -501,6 +549,23 @@ auth checks, and so the last topic, _Topic 4_, is chosen. | |
This gives the resolved state at _Message 3_ to be _Topic 4_. | ||
|
||
|
||
## Example 2 - Rejected Events | ||
|
||
The following is an example room DAG, where time flows down the page. The event | ||
`D` is initially rejected by the server (due to not passing auth against the | ||
state), but does pass auth against its auth chain. | ||
|
||
![state-res-rejected.png](images/state-res-rejected.png) | ||
erikjohnston marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
(Note that the blue lines are the power levels pointed to in the event's auth | ||
events) | ||
|
||
At `F` we first resolve the power levels, which results in `E`. When we then go | ||
to resolve the topics against the partially resolved state, Bob has ops and so | ||
the resolved state includes the topic change `D`, even though it was initially | ||
rejected. | ||
|
||
|
||
## Notes | ||
|
||
[^1]: In the current room protocol these are: the create event, power levels, | ||
|
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 still think it would be useful to have the summary of:
in here somehow, to make it clear what the bigger picture for rejections is.
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.
Ideally that would be in the section of the spec which talks about how to handle rejections, not sure if it makes sense to duplicate it here?
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 it actually exist in that bit of the spec, though? i still think it's key to understanding this part of the world, and it needs to be spelt out clearly int he spec.
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'll go and add it to the spec then and block this MSC on that.
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.
#1755