-
Notifications
You must be signed in to change notification settings - Fork 7
Accepting invites from federation fails #12
Description
Describe the bug
If users on a synapse homeserver with this module get invited from a user via federation the invite is not automatically accepted.
To Reproduce
Steps to reproduce the behavior:
- Install synapse and this module
- Let an external Usere invite a user on your homeserver
- The invite is not automatically accepted.
Expected behaviour
The invite is automatically accepted.
Desktop (please complete the following information):
does not apply
Smartphone (please complete the following information):
does not apply
Additional context
The tested homeservers are synapse on version 1.61.1 in a dockerized environment. The module was installed in the container with pip. koyax.org is the federated homeserver and lippesola.de the one with the module installed. lippesola.de has federation whitelisting enabled with koyax.org beeing part of that list. koyax.org has unrestricted federation.
Logs
This is the log of the synaspe server with the module installed when a federated user invites a local user.
2022-07-04 11:51:09,750 - synapse.http.matrixfederationclient - 620 - INFO - PUT-167 - {GET-O-13} [koyax.org] Got response headers: 403 Forbidden
2022-07-04 11:51:09,751 - synapse.http.matrixfederationclient - 700 - WARNING - PUT-167 - {GET-O-13} [koyax.org] Request failed: GET matrix://koyax.org/_matrix/federation/v1/make_join/%21gmGAJbNDZtuUfEIJvo%3Akoyax.org/%40admin%3Alippesola.de?ver=1&ver=2&ver=3&ver=4&ver=5&ver=6&ver=org.matrix.msc2176&ver=7&ver=8&ver=9&ver=org.matrix.msc2716v3&ver=org.matrix.msc3787: HttpResponseException('403: Forbidden')
2022-07-04 11:51:09,752 - synapse.events.third_party_rules - 406 - ERROR - PUT-167 - Failed to run module API callback <bound method InviteAutoAccepter.on_new_event of <synapse_auto_accept_invite.InviteAutoAccepter object at 0x7fceb94152b0>>: 403: You are not invited to this room.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/synapse/federation/federation_client.py", line 694, in _try_destination_list
return await callback(destination)
File "/usr/local/lib/python3.9/site-packages/synapse/federation/federation_client.py", line 791, in send_request
ret = await self.transport_layer.make_membership_event(
File "/usr/local/lib/python3.9/site-packages/synapse/federation/transport/client.py", line 322, in make_membership_event
return await self.client.get_json(
File "/usr/local/lib/python3.9/site-packages/synapse/http/matrixfederationclient.py", line 1066, in get_json
response = await self._send_request_with_optional_trailing_slash(
File "/usr/local/lib/python3.9/site-packages/synapse/http/matrixfederationclient.py", line 405, in _send_request_with_optional_trailing_slash
response = await self._send_request(request, **send_request_args)
File "/usr/local/lib/python3.9/site-packages/synapse/http/matrixfederationclient.py", line 659, in _send_request
raise exc
synapse.api.errors.HttpResponseException: 403: Forbidden
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/synapse/events/third_party_rules.py", line 404, in on_new_event
await callback(event, state_events)
File "/usr/local/lib/python3.9/site-packages/synapse_auto_accept_invite/__init__.py", line 99, in on_new_event
await self._api.update_room_membership(
File "/usr/local/lib/python3.9/site-packages/synapse/module_api/__init__.py", line 999, in update_room_membership
event_id, _ = await self._hs.get_room_member_handler().update_membership(
File "/usr/local/lib/python3.9/site-packages/synapse/handlers/room_member.py", line 524, in update_membership
result = await self.update_membership_locked(
File "/usr/local/lib/python3.9/site-packages/synapse/handlers/room_member.py", line 860, in update_membership_locked
remote_join_response = await self._remote_join(
File "/usr/local/lib/python3.9/site-packages/synapse/handlers/room_member.py", line 1611, in _remote_join
event_id, stream_id = await self.federation_handler.do_invite_join(
File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation.py", line 487, in do_invite_join
origin, event, room_version_obj = await self._make_and_verify_event(
File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation.py", line 922, in _make_and_verify_event
) = await self.federation_client.make_membership_event(
File "/usr/local/lib/python3.9/site-packages/synapse/federation/federation_client.py", line 842, in make_membership_event
return await self._try_destination_list(
File "/usr/local/lib/python3.9/site-packages/synapse/federation/federation_client.py", line 724, in _try_destination_list
raise synapse_error from e
synapse.api.errors.ProxiedRequestError: 403: You are not invited to this room.
2022-07-04 11:51:09,756 - synapse.access.http.8008 - 450 - INFO - PUT-167 - 193.42.11.42 - 8008 - {koyax.org} Processed request: 0.646sec/0.001sec (0.019sec, 0.003sec) (0.015sec/0.122sec/12) 1485B 200 "PUT /_matrix/federation/v2/invite/%21gmGAJbNDZtuUfEIJvo%3Akoyax.org/%24GW-iHVMj0_tgK01fK0PeIOafb--4uYL9GwN_qHv9f6U HTTP/1.0" "Synapse/1.61.1" [0 dbevts]