-
Notifications
You must be signed in to change notification settings - Fork 411
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 <[email protected]>
Co-authored-by: Travis Ralston <[email protected]>
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.
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 there’s general agreement that string packing is not a great long-term idea. This is not only a topic in the context of this MSC but also in the context of MSC4143.
The reason it’s being considered is that it’s an pragmatic change — lightweight for SDK maintainers to adopt and gives already (amongst others) the nice feature of pragmatic name-spacing which is a powerful property.
In contrast a big-bang change is disruptive and complex. Probably leading to a situation where nobody currently has time to implement it.
Hence, I am proposing deliver value without disruption (=using string packing) over disruptive and complex
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.
Despite frequent appearances to the contrary, matrix is intended to be a production-quality protocol, not some finished-over-a-weekend demo. You don't do "pragmatic" hacks in such a project, especially not for a new feature. If the feature requires "complex and disruptive" changes, so be it - this PR has been sitting around for three and a half years now, it can wait a couple more until those changes are worked out.
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.
Right now, I am minded that the problems with this proposal (fundamentally: it's a hack that we don't want to have to support in the long term) outweigh the advantages of landing it swiftly.
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?
MSCs proposed for Final Comment Period (FCP) should meet the requirements outlined in the checklist prior to being accepted into the spec. This checklist is a bit long, but aims to reduce the number of follow-on MSCs after a feature lands. SCT members: please check off things you check for, and raise a concern against FCP if the checklist is incomplete. If an item doesn't apply, prefer to check it rather than remove it. Unchecking items is encouraged where applicable. Checklist:
|
Is "attempts to pack structured data into a JSON string" not a valid concern in the opinion of the SCT? |
Please use threads for conversation, as otherwise there's a 95% chance we'll never see it. The string packing concern is tracked as alternatives not being sufficiently explored, per https://github.com/matrix-org/matrix-spec-proposals/pull/3757/files#r2192809774 |
This is problematic if a user needs to publish multiple state | ||
events of the same type in a room, but would like to set access control so | ||
that only they can subsequently update the event. An example of this is if a | ||
user wishes to participate in VoIP call as per [MatrixRTC (MSC4143)]( | ||
https://github.com/matrix-org/matrix-spec-proposals/blob/toger5/matrixRTC/proposals/4143-matrix-rtc.md#the-matrixrtc-room-state), | ||
by sending a state event for each of their devices that is to participate in the call. | ||
They will typically not want other users in the room to be able to overwrite those state events, | ||
so there ought to be a mechanism to prevent other users from doing so. |
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.
To be honest, it's not clear to me that MatrixRTC call events should be state events. Call state is very ephemeral information, while room state is generally meant for longer-lived state, like room configuration.
Areas where room state did end up being used for quicker evolving information are precisely those that showcase many problems with such an approach: the need to retain stricter ownership over a subset of state events; the need to allow less privileged users to send state events, which brings about state spam concerns; the large volume of events calling for a mechanism to delete state, which turns out to be an almost impossible feat. Not to mention that state events in today's Matrix are unencrypted. It all screams bad fit to me.
I realise this is coming a bit late to the party given when MatrixRTC implementations are already running in the wild. But given that this is used as the sole example of a requirement for this MSC and there is widespread dissatisfaction with string packing, I think it needs to be raised.
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 second this. State events is the wrong place for this data, and by putting it in this wrong place we are creating a rod for our own back. String packing is, in the words of other people, a horrible hack. Does it work? Undeniably yes. Do we want to bake this into the protocol permanently? No. This is precisely the job of the SCT to block this kind of thing imo.
Now this does beg the question: what is the right place then? I've banged on internally that there isn't really a right place for this kind of data currently, and have been spending my downtime slowly crafting a proposal for an alternative. Effectively, all we want is:
- Custom EDUs which can be sent by clients
- persistent EDUs which guarantee delivery of the latest value sent on a per-room, per-user basis.
Thus sending a state event only you can modify becomes a persistent EDU (quite an oxymoron given the E stands for Ephemeral!) with whatever custom type/content you want.
The main driver for this MSC afaict is MatrixRTC so we can even drop the "custom" part for now and only have fixed known EDUs for now to reduce the scope and risk of the changes.
I'd be much happier to thumbs up a persistent EDU proposal than shoehorn in owned state events.
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.
State events is the wrong place for this data
Agreed.
Apart from the ephemerality of the data, another thing that makes it different to room state is that there is never any real reason to do state resolution. We only ever care about the "current" state, and (unlike regular state) there is a single server that can and should be trusted to be authoritative.
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 be much happier to thumbs up a persistent EDU proposal than shoehorn in owned state events.
#4354 is this.
This MSC is blocked on conversations around possibly using non-state-events for VoIP becoming resolved. |
Team member @turt2live has proposed to close this. The next step is review by the rest of the tagged people: Once at least 75% of reviewers approve (and there are no outstanding concerns), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for information about what commands tagged team members can give me. |
Although both [the spec](https://spec.matrix.org/unstable/appendices/#server-name) | ||
and [RFC 1035 §2.3.1](https://www.rfc-editor.org/rfc/rfc1035#section-2.3.1) | ||
forbid the presence of underscores in domain names, | ||
there noneless exist resolvable domain names that contain underscores. |
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.
there noneless exist resolvable domain names that contain underscores. | |
there nonetheless exist resolvable domain names that contain underscores. |
Rendered
Implementations:
Written by @ara4n , with contributions from @Johennes and @andybalaam .
Shepherd: @AndrewFerr
SCT Stuff:
FCP closure tickyboxes
MSC checklist