Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 603166f

Browse files
committed
Fix: Pillow error when uploading RGBA image (#3325) (#6241)
* commit '81731c6e7': Fix: Pillow error when uploading RGBA image (#3325) (#6241) Add User-Interactive Auth to /account/3pid/add (#6119) Lint Changelog Discard retention policies when retrieving state blacklist more tests Newsfile Add tests Propagate reason in remotely rejected invites MSC2367 Allow reason field on all member events
2 parents 2f57741 + 81731c6 commit 603166f

File tree

13 files changed

+183
-14
lines changed

13 files changed

+183
-14
lines changed

.buildkite/worker-blacklist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ Don't get pushed for rooms you've muted
5757
Rejected events are not pushed
5858
Test that rejected pushers are removed.
5959
Events come down the correct room
60+
61+
# https://buildkite.com/matrix-dot-org/sytest/builds/326#cca62404-a88a-4fcb-ad41-175fd3377603
62+
Presence changes to UNAVAILABLE are reported to remote room members
63+
If remote user leaves room, changes device and rejoins we see update in sync
64+
uploading self-signing key notifies over federation
65+
Inbound federation can receive redacted events
66+
Outbound federation can request missing events

changelog.d/6119.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Require User-Interactive Authentication for `/account/3pid/add`, meaning the user's password will be required to add a third-party ID to their account.

changelog.d/6241.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix error from the Pillow library when uploading RGBA images.

changelog.d/6434.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for MSC 2367, which allows specifying a reason on all membership events.

synapse/handlers/federation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,9 +1435,9 @@ def on_invite_request(self, origin, pdu):
14351435
return event
14361436

14371437
@defer.inlineCallbacks
1438-
def do_remotely_reject_invite(self, target_hosts, room_id, user_id):
1438+
def do_remotely_reject_invite(self, target_hosts, room_id, user_id, content):
14391439
origin, event, event_format_version = yield self._make_and_verify_event(
1440-
target_hosts, room_id, user_id, "leave"
1440+
target_hosts, room_id, user_id, "leave", content=content,
14411441
)
14421442
# Mark as outlier as we don't have any state for this event; we're not
14431443
# even in the room.

synapse/handlers/room_member.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def _remote_join(self, requester, remote_room_hosts, room_id, user, content):
9999
raise NotImplementedError()
100100

101101
@abc.abstractmethod
102-
def _remote_reject_invite(self, requester, remote_room_hosts, room_id, target):
102+
def _remote_reject_invite(
103+
self, requester, remote_room_hosts, room_id, target, content
104+
):
103105
"""Attempt to reject an invite for a room this server is not in. If we
104106
fail to do so we locally mark the invite as rejected.
105107
@@ -109,6 +111,7 @@ def _remote_reject_invite(self, requester, remote_room_hosts, room_id, target):
109111
reject invite
110112
room_id (str)
111113
target (UserID): The user rejecting the invite
114+
content (dict): The content for the rejection event
112115
113116
Returns:
114117
Deferred[dict]: A dictionary to be returned to the client, may
@@ -526,7 +529,7 @@ def _update_membership(
526529
# send the rejection to the inviter's HS.
527530
remote_room_hosts = remote_room_hosts + [inviter.domain]
528531
res = yield self._remote_reject_invite(
529-
requester, remote_room_hosts, room_id, target
532+
requester, remote_room_hosts, room_id, target, content,
530533
)
531534
return res
532535

@@ -1056,13 +1059,15 @@ def _remote_join(self, requester, remote_room_hosts, room_id, user, content):
10561059
)
10571060

10581061
@defer.inlineCallbacks
1059-
def _remote_reject_invite(self, requester, remote_room_hosts, room_id, target):
1062+
def _remote_reject_invite(
1063+
self, requester, remote_room_hosts, room_id, target, content
1064+
):
10601065
"""Implements RoomMemberHandler._remote_reject_invite
10611066
"""
10621067
fed_handler = self.federation_handler
10631068
try:
10641069
ret = yield fed_handler.do_remotely_reject_invite(
1065-
remote_room_hosts, room_id, target.to_string()
1070+
remote_room_hosts, room_id, target.to_string(), content=content,
10661071
)
10671072
return ret
10681073
except Exception as e:

synapse/handlers/room_member_worker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ def _remote_join(self, requester, remote_room_hosts, room_id, user, content):
5555

5656
return ret
5757

58-
def _remote_reject_invite(self, requester, remote_room_hosts, room_id, target):
58+
def _remote_reject_invite(
59+
self, requester, remote_room_hosts, room_id, target, content
60+
):
5961
"""Implements RoomMemberHandler._remote_reject_invite
6062
"""
6163
return self._remote_reject_client(
6264
requester=requester,
6365
remote_room_hosts=remote_room_hosts,
6466
room_id=room_id,
6567
user_id=target.to_string(),
68+
content=content,
6669
)
6770

6871
def _user_joined_room(self, target, room_id):

synapse/replication/http/membership.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class ReplicationRemoteRejectInviteRestServlet(ReplicationEndpoint):
9393
{
9494
"requester": ...,
9595
"remote_room_hosts": [...],
96+
"content": { ... }
9697
}
9798
"""
9899

@@ -107,7 +108,7 @@ def __init__(self, hs):
107108
self.clock = hs.get_clock()
108109

109110
@staticmethod
110-
def _serialize_payload(requester, room_id, user_id, remote_room_hosts):
111+
def _serialize_payload(requester, room_id, user_id, remote_room_hosts, content):
111112
"""
112113
Args:
113114
requester(Requester)
@@ -118,12 +119,14 @@ def _serialize_payload(requester, room_id, user_id, remote_room_hosts):
118119
return {
119120
"requester": requester.serialize(),
120121
"remote_room_hosts": remote_room_hosts,
122+
"content": content,
121123
}
122124

123125
async def _handle_request(self, request, room_id, user_id):
124126
content = parse_json_object_from_request(request)
125127

126128
remote_room_hosts = content["remote_room_hosts"]
129+
event_content = content["content"]
127130

128131
requester = Requester.deserialize(self.store, content["requester"])
129132

@@ -134,7 +137,7 @@ async def _handle_request(self, request, room_id, user_id):
134137

135138
try:
136139
event = await self.federation_handler.do_remotely_reject_invite(
137-
remote_room_hosts, room_id, user_id
140+
remote_room_hosts, room_id, user_id, event_content,
138141
)
139142
ret = event.get_pdu_json()
140143
except Exception as e:

synapse/rest/client/v1/room.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ async def on_POST(self, request, room_id, membership_action, txn_id=None):
715715
target = UserID.from_string(content["user_id"])
716716

717717
event_content = None
718-
if "reason" in content and membership_action in ["kick", "ban"]:
718+
if "reason" in content:
719719
event_content = {"reason": content["reason"]}
720720

721721
await self.room_member_handler.update_membership(

synapse/rest/client/v2_alpha/account.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ def __init__(self, hs):
725725
self.auth = hs.get_auth()
726726
self.auth_handler = hs.get_auth_handler()
727727

728+
@interactive_auth_handler
728729
@defer.inlineCallbacks
729730
def on_POST(self, request):
730731
requester = yield self.auth.get_user_by_req(request)
@@ -735,6 +736,10 @@ def on_POST(self, request):
735736
client_secret = body["client_secret"]
736737
sid = body["sid"]
737738

739+
yield self.auth_handler.validate_user_via_ui_auth(
740+
requester, body, self.hs.get_ip_from_request(request)
741+
)
742+
738743
validation_session = yield self.identity_handler.validate_threepid_session(
739744
client_secret, sid
740745
)

0 commit comments

Comments
 (0)