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

Don't throw exception on m.login.jwt automatic user creation #7585

Merged
merged 4 commits into from
Jun 1, 2020

Commits on May 27, 2020

  1. login: Fix bug in automatic JWT user creation

    When a previously non-existent user is authenticated with m.login.jwt
    (after the token has been validated), the user should be created. But a
    bug made checking if the user exists reset the claimed username to None,
    and we would see generic TypeError exceptions when we asked synapse to
    process it further:
    
      ...
      File "/usr/lib/python3/dist-packages/synapse/rest/client/v1/login.py", line 393, in do_jwt_login
        result = await self._complete_login(
      File "/usr/lib/python3/dist-packages/synapse/rest/client/v1/login.py", line 338, in _complete_login
        localpart=UserID.from_string(user_id).localpart
      File "/usr/lib/python3/dist-packages/synapse/types.py", line 171, in from_string
        if len(s) < 1 or s[0:1] != cls.SIGIL:
      TypeError: object of type 'NoneType' has no len()
    
    This regression was introduced in 541f1b9 (part of the v1.6.0 release
    of synapse); it only affects auth flows where _complete_login is called
    with create_non_existant_user=True, which turns out is only the
    m.login.jwt auth flow.
    
    Signed-off-by: Olof Johansson <olof@ethup.se>
    olof committed May 27, 2020
    Configuration menu
    Copy the full SHA
    8a8cf9c View commit details
    Browse the repository at this point in the history
  2. login: fix typo in parameter name (existant -> existent)

    The parameter is for an internal method with no use outside of the
    module (as confirmed by grepping for the method name in the repository).
    
    Signed-off-by: Olof Johansson <olof@ethup.se>
    olof committed May 27, 2020
    Configuration menu
    Copy the full SHA
    baf7ace View commit details
    Browse the repository at this point in the history

Commits on May 29, 2020

  1. Fix and improve changelog fragment as suggested by clokep

    Signed-off-by: Olof Johansson <olof@ethup.se>
    olof committed May 29, 2020
    Configuration menu
    Copy the full SHA
    1624c10 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2020

  1. Add unit tests for m.login.jwt flow

    Signed-off-by: Olof Johansson <olof@ethup.se>
    olof committed Jun 1, 2020
    Configuration menu
    Copy the full SHA
    f7ac254 View commit details
    Browse the repository at this point in the history