-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Synapse doesn't accept m.room.power_level events with string values even though it sends them #12538
Comments
I'm not really sure what we should do about this, tbh. Obviously it's caused by the validation in #10232. On the one hand, it seems obvious that we shouldn't allow clients to send malformed PL events. On the other, if the PL event is malformed to start with, it's maybe not reasonable to require clients to "fix" it. But attempting to "fix" the event before we pass it on to clients doesn't feel good either. Maybe we should allow clients to send malformed PL events if the original PL event is malformed? |
(Maybe we should just fix #12537 and then tell everyone they have to upgrade to a modern room version...) |
While you all resolve this, is there any workaround we can use for our channel? I need to be able to give mod rights to others as it's currently just me and I am not always online to moderate. |
use the /devtools to replace the strings in the PL event. |
Worked for me. Was unable to give mod powers until i changed all strings into integers. |
--- a/synapse/events/validator.py
+++ b/synapse/events/validator.py
@@ -94,6 +94,11 @@ class EventValidator:
)
if event.type == EventTypes.PowerLevels:
+ users = event.content.get("users")
+ if users:
+ for key, val in users.items():
+ if type(val) is str:
+ users[key] = int(val)
try:
jsonschema.validate(
instance=event.content, |
Richard gave me "thumbs down" but 2 days ago in #12537 he wanted to pass them through int() himself :) |
After figuring out what |
In room upgrades. Not where you suggest. |
Let's do so. |
Description
Synapse will happily send clients malformed m.room.power_level events with string power levels yet will not accept them, causing stuck PLs in a room where the client shouldn't be expected to have to sanitise the event which it was sent.
Steps to reproduce
"0"
More context element-hq/element-web#19751 (comment)
Related #12537 (same cause)
Version information
The text was updated successfully, but these errors were encountered: