Skip to content
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

Enabling session_lifetime in the configuration prevents registration of guest users #12440

Open
matrixbot opened this issue Dec 19, 2023 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

matrixbot commented Dec 19, 2023

This issue has been migrated from #12440.


Description

When the configuration option session_lifetime (used to log out users after sign in after a certain amount of time) is used, attempts to register as a guest user will fail due to a 500 Internal Server Error because of a python exception.

Steps to reproduce

  • Enable configuration option session_lifetime to something like 30d
  • Host the Element client which points to the homeserver by default (set within config.json for Element)
  • Observe the 'Explore Rooms' button not showing under the Sign In and Create Account button, and the POST request Element makes to register a Guest account fail with a response code of 500 Internal Server Error

I was trying to get the Explore Room button to work in Element.
After lots of digging around to, well, not much useful. I then found that the POST request to /_matrix/client/r0/register?kind=guest responds with a 500 Internal Server Error status code, shows an exception in homeserver.log, and which prevented the button from showing up.

Expectation: Even with the session_lifetime option, guest users can be registered (what happens with session_lifetime really depends)

homeserver.log:

2022-04-11 20:57:46,503 - synapse.access.http.8008 - 427 - INFO - GET-71697 - ***.***.***.*** - 8008 - {None} Processed request: 0.001sec/0.001sec (0.001sec, 0.000sec) (0.000sec/0.000sec/0) 558B 200 "GET /_matrix/client/versions HTTP/1.0" "***********************************************************************************************************" [0 dbevts]
2022-04-11 20:57:46,786 - synapse.handlers.register - 358 - INFO - POST-71699 - Skipping auto-join for @113:jacksonchen666.com because auto-join for guests is disabled
2022-04-11 20:57:46,787 - synapse.http.server - 100 - ERROR - POST-71699 - Failed handle request via 'RegisterRestServlet': <XForwardedForRequest at 0x7f81c6432350 method='POST' uri='/_matrix/client/r0/register?kind=guest' clientproto='HTTP/1.0' site='8008'>
Traceback (most recent call last):
  File "/home/matrix-synapse/synapse/env/lib/python3.10/site-packages/synapse/http/server.py", line 268, in _async_render_wrapper
    callback_return = await self._async_render(request)
  File "/home/matrix-synapse/synapse/env/lib/python3.10/site-packages/synapse/http/server.py", line 470, in _async_render
    callback_return = await raw_callback_return
  File "/home/matrix-synapse/synapse/env/lib/python3.10/site-packages/synapse/rest/client/_base.py", line 99, in wrapped
    return await orig(*args, **kwargs)
  File "/home/matrix-synapse/synapse/env/lib/python3.10/site-packages/synapse/rest/client/register.py", line 451, in on_POST
    ret = await self._do_guest_registration(body, address=client_addr)
  File "/home/matrix-synapse/synapse/env/lib/python3.10/site-packages/synapse/rest/client/register.py", line 849, in _do_guest_registration
    ) = await self.registration_handler.register_device(
  File "/home/matrix-synapse/synapse/env/lib/python3.10/site-packages/synapse/handlers/register.py", line 768, in register_device
    res = await self._register_device_client(
  File "/home/matrix-synapse/synapse/env/lib/python3.10/site-packages/synapse/handlers/register.py", line 812, in register_device_inner
    raise Exception(
Exception: session_lifetime is not currently implemented for guest access
2022-04-11 20:57:46,790 - synapse.access.http.8008 - 427 - INFO - POST-71699 - ***.***.***.*** - 8008 - {None} Processed request: 0.023sec/0.001sec (0.007sec, 0.000sec) (0.001sec/0.016sec/2) 55B 500 "POST /_matrix/client/r0/register?kind=guest HTTP/1.0" "*************************************************************************************************" [0 dbevts]

Version information

If not matrix.org:

  • Version: 1.55.2 updated to 1.56.0 since then (tested, issue persists)

  • Install method: pip install matrix-synapse[postgres] (with the python virtual environment located at /home/matrix-synapse/synapse/env/, with a nginx reverse proxy & delegation)

  • Platform: Linux, Fedora 35, Not within a container or VM
@matrixbot matrixbot changed the title Dummy issue Enabling session_lifetime in the configuration prevents registration of guest users Dec 21, 2023
@matrixbot matrixbot reopened this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant