-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Power level values can be ints or strings #853
Comments
Further investigation reveals that Synapse still doesn't validate incoming power level events properly 🤦 |
related: matrix-org/synapse#10232? |
The linked PR adds validation to ensure power levels are integers. Since there was no validation before, will we need a room version bump to ensure we don't break older rooms which might not be upholding this? |
In theory, I suppose so. But at this point it's hard to see us encountering stringy PL events unless somebody is maliciously trying to split-brain the room. Since sending PL events of any flavour requires you to have admin perms on the room, I'm inclined to say that if any admins want to split-brain their own room, they can go right ahead. It might be better just to get the benefit of validation out sooner. |
I'm nervous about changing the allowed format of events in existing rooms TBH, especially for something like power levels which can have extensive knock on effects. Unless we can be comfortable that no rooms exist in the wild with string value power levels in their auth chain I'm really very dubious about not cutting a room version. We should absolutely be validating this on the client side though. |
Can we please please please spec exactly what the allowed string formats are for legacy support? Synapse allows things like |
From the python docs;
This seems to be the extent of it. So an algorithm for normalising pre-MSC3667 powerlevels seems to be;
|
we'd also have to deal with also, just to mention it because it's in the older thread: synapse still parses and handles strings as ints in modern room versions. It has not been formally fixed yet. |
Apologies, somewhere in the back of my mind, i thought that powerlevels were unsigned, and
These are all the possible representations (according to the python docs), i'm not aware of any more. |
Trying to understand what the current state of play is here. I think:
|
for clarity, and because I never wrote it down, the plan is to address the last point at the same time as adding MSC3667 to the spec. It's mostly a matter of effort, and given we'll be in the area when writing the MSC up it makes sense to go back and fix the other room versions. If for some reason that ends up taking forever then we can obviously go through and write the words into the spec appropriately. I would encourage us to make an effort to get MSC3667 into an assigned room version, though. |
A long time ago there was a bug in Synapse where the values for the power level were strings rather than ints. This was fixed, but in order to not break rooms Synapse continued to accept power level values that were either ints or strings.
This behaviour should be documented.
This behaviour is also implemented in gomatrixserverlib/Dendrite and Ruma/Conduit.
Ideally we should be able to only document this for v1 rooms, but I haven't checked if this was fixed before or after v2 rooms were introduced (but I assume so).
The text was updated successfully, but these errors were encountered: