Skip to content

register_rejects_if_user_already_exists does not account for implementations requiring auth before performing validation #955

Open

Description

@timedoutuk

TestRegistration/parallel/POST_/register_rejects_if_user_already_exists fails if the homeserver returns a UIA challenge instead of outright rejecting the request due to the duplicate user. Continuwuity, for example, still rejects the request as expected after completing UIA, but interactive auth is required before it is willing to progress further:

$ curl --json '{"username": "nex", "password": "hello world"}' 10.11.10.134:8008/_matrix/client/v3/register
{"flows":[{"stages":["m.login.registration_token"]}],"params":{},"session":"redacted"}%                                                                                                    $ curl --json '{"username": "nex", "password": "hello world", "auth": {"type": "m.login.registration_token", "token": "redacted", "session": "redacted"}}' 10.11.10.134:8008/_matrix/client/v3/register
{"errcode":"M_USER_IN_USE","error":"Username is not available."}

There's no spec that defines what order these two things should be checked in, so the test should probably try to complete the challenge if it receives one.

Activity

  1. timedoutuk commented on Nov 4, 2026

    @timedoutuk
    ContributorAuthor

    Same problem for the special characters test

      ❌ TestRegistration/parallel/POST_/register_rejects_usernames_with_special_characters (0s)
        apidoc_register_test.go:134: MatchResponse got status 401 want 400 - http://127.0.0.1:32872/_matrix/client/v3/register => {"flows":[{"stages":["m.login.dummy"]}],"params":{},"session":"redacted"}
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions