-
Notifications
You must be signed in to change notification settings - Fork 401
MSC3757: Restricting who can overwrite a state event #3757
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as duplicate.
This comment was marked as duplicate.
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.
One nit, else this looks sound.
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Co-authored-by: Travis Ralston <travisr@matrix.org>
them - and they also are awkward for some client implementations to | ||
manipulate. | ||
|
||
## Proposal |
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.
My general concern is that we already have JSON available to us, so we should use that. String packing works in areas where we don't have as fine control (voip call candidates, for example), but for something like this we can and should afford fields.
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.
Since the SCT came down on the side of this proposal vs MSC3760 I consider this resolved. Please unresolve if you disagree.
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'm not sure where the conversation about the SCT preferring this over MSC3760 happened, but I'm strongly against the current proposal. String packing is going to cause bugs, having separate fields seems better in every sense.
Hence my concern I've left about insufficient alternatives being explored.
|
This proposal requires re-review from several SCT members and adjacent folks. The priority is a bit unclear to me, but that is a different problem (see room). |
This is still the crux of this proposal and I'm in agreement with @turt2live that I'm a -1 for the string packing. |
Maybe it's worth having a new MSC to explore one of the top-level field alternatives: |
Maybe MSC3760 or MSC3779 was supposed to be that? (3760 appears to be very similar to this.) |
The size of a state key suffix after a leading user ID and the separator character is limited to | ||
**255 bytes** so that any such suffix may follow any user ID without the complete state key | ||
ever surpassing the total state key size limit. | ||
Similarly, the size of a state key without a leading user ID is limited to **255 bytes** so that any | ||
state key without a leading user ID may be given one without ever surpassing the total size limit. |
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.
Is this conversion between prefixed and unprefixed state keys a real requirement? It seems to lead to a lot of complexity.
If we're doing this, I'd be inclined to just increase max state key length to (say) 512 bytes, and be done with it.
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 think I was thrown off a bit by the explanation involving currently-valid state keys and thinking that this implied wanting to user-namespace currently state keys. Really the point is simply that, with a maximum length user ID, you need some space to fit something on the end, so yeah, I'd say just keep it simple & double state key length.
Users with a higher power level than a state event's original sender may overwrite the event | ||
despite their user ID not matching the one in event's `state_key`. This fixes an abuse | ||
vector where a user can immutably graffiti the state within a room | ||
by sending state events whose `state_key` is their user ID. |
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'd say there's a strong argument for making this a separate MSC, rather than trying to fix two things at once.
@@ -0,0 +1,118 @@ | |||
# MSC3757: Restricting who can overwrite a state event. |
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.
Revisiting this a few months later (sorry), I still find my suggestion clearer.
@mscbot resolve concern changes to auth rules are unclear |
Unknown concern 'concern changes to auth rules are unclear'. |
Concerns-I-have-raised update: @mscbot resolve Alternatives section is missing some alternatives.
The introduction currently relies on location sharing to drive it, which is a deprioritized feature at the spec level. I highly suggest adding the VoIP impact to the introduction to naturally drive this MSC up the list.
This still appears to be the case. |
Is matrix-org/complement#733 not sufficient? |
As the spec currently enforces [a size limit of 255 bytes for both user IDs and state keys]( | ||
https://spec.matrix.org/unstable/client-server-api/#size-limits), | ||
the size limit on state keys is increased to **511 bytes** to allow prefixing any currently-valid | ||
state key with a maximum-length user ID (and a separator character). | ||
The size of a state key suffix after a leading user ID and the separator character is limited to | ||
**255 bytes** so that any such suffix may follow any user ID without the complete state key | ||
ever surpassing the total state key size limit. | ||
Similarly, the size of a state key without a leading user ID is limited to **255 bytes** so that any | ||
state key without a leading user ID may be given one without ever surpassing the total size limit. |
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.
This part can most charitably be described as an awful hack. There should never be a reason to encode multiple independent values into a single string field inside a structured data format like JSON, let alone then enforcing strict length limits on different parts. No, this is terrible, the section "Multi-component state keys" describes what a real solution would have to look like.
terminate the leading user ID was deliberately chosen to be an underscore, as it is not | ||
allowed in [any form of server name](https://spec.matrix.org/v1.11/appendices/#server-name) | ||
(either a DNS name or IPv4/6 address, with or without a numeric port specifier) and thus cannot be | ||
confused as part of the server name of a leading user ID (with one caveat mentioned as a |
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.
But above you've said that resolvable domain names with underscores exist: wouldn't this allow the attack you talk about below?
Rendered
Implementations:
Written by @ara4n , with contributions from @Johennes and @andybalaam .
Shepherd: @AndrewFerr
SCT Stuff:
FCP tickyboxes
No MSC checklist.
Status: "At risk" due to:
Next steps: the SCT should review the MSC as a group and determine how to proceed. Potential outcomes are FCP-closure, cancellation of FCP, or unblocked forward movement towards merge.