More clarity around validating proposals - #675
Conversation
|
Discussed 19 May. Will leave it open for further review from @bifurcation @raphaelrobert review. |
|
Virtual interim 2022-05-19:
|
| To verify that a LeafNode is valid regardless of its use, the client starts | ||
| with the following steps: |
There was a problem hiding this comment.
I'm not clear why this says "regardless of its use". Maybe you mean "In all these cases...", but I would prefer leaving it unadorned to not imply that there's a restriction to those cases (in case another one comes up).
If you're going to say "starts with..." you need to have more steps that follow.
There was a problem hiding this comment.
Thanks for pointing this out! (We used to have a earlier version with more cases and more steps.)
| proposals is valid as specified in {{validating-proposals}}. A list is invalid if, for example, | ||
| it includes a proposal with an invalid signature, a proposal sent within a different epoch. |
There was a problem hiding this comment.
Suggest using a more interesting example here, such as including an Update and Remove for the same member.
| requiring application-level permissions to add members, or rules concerning | ||
| non-default proposal types. | ||
|
|
||
| For an external commit, the list is valid if: |
There was a problem hiding this comment.
It's slightly confusing that the above is a negative check, and this is a positive check. But that might be unavoidable. I might rephrase as something like:
... the list is valid if it contains only the following proposals (not necessarily in this order):
- Exactly one ExternalInit proposal
- At most one Remove proposal...
- Zero or more PSK proposals...
- No other proposals
(The last bullet is a little redundant, but it bears repeating.)
There was a problem hiding this comment.
(And maybe we should require order here!)
|
I opened a PR here that resolves the merge conflicts and makes some additional suggested changes: mulmarta#1 |
|
@mulmarta Please update to resolve merge conflicts. |
Co-authored-by: raphaelrobert <raphaelrobert@users.noreply.github.com>
Co-authored-by: Richard Barnes <rlb@ipv.sx>
Co-authored-by: Richard Barnes <rlb@ipv.sx>
dc64635 to
5d33f4d
Compare
bifurcation
left a comment
There was a problem hiding this comment.
Couple of nits, otherwise lgtm.
| * After processing the commit the ratchet tree is invalid, in particular, if it | ||
| contains any leaf node that is invalid according to {{leaf-node-validation}}. |
There was a problem hiding this comment.
I'm not sure why this is here. It seems like it follows from the Add/Update LeafNode validity requirements.
The text in the RFC around validating proposals, choosing which proposals go into a commit and how to validate a received commit could do with a bit more work.
The root issue is that Section 13.2 states “The sender of a Commit MUST include all valid proposals that it has received during the current epoch. Invalid proposals include, for example, proposals with an invalid signature or proposals that are semantically invalid, such as an Add when the sender does not have the application-level permission to add new users.” There are two intertwined issues with this text:
Put simply, it doesn’t make sense to only validate proposals individually. Instead one should validate if the full list of proposals can be committed. Indeed, other parts of the RFC enforce validation steps that apply to the full list. E.g.
In fact, once extensions come into play there are likely many more similar situations, even ones affecting lists of otherwise benign proposals (e.g. Add/Remove). Suppose a chat app is built on MLS with a custom room moderator roles extension. The app wants MLS to enforce two rules: Only mods can Add/Remove. Rooms should always have at least 1 Mod. Here’s how the RFC’s current text can become a problem: A and B are the only mods in a room. A makes proposal P1 that removes B. Meanwhile, B makes prop P2 that removes A. C gets both proposals. What should C do?
So, to clean all this up a bit more, this PR proposes the following main changes:
Note that the validation in section "Proposals" can be done when a commit is received. The final check in "Validating Proposals" is done when a commit is created and when it is received.
This also fixes #657.