element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.2k stars 2k forks source link

3PID invite: Wrong URL generated #9062

Closed c7hm4r closed 5 years ago

c7hm4r commented 5 years ago

Description

When I try to invite the MXISD federation test user via email (mxisd-federation-test@kamax.io), Riot generates a web request to

https://riot.my-server.org/matrix.my-server.org/_matrix/identity/api/v1/lookup?medium=email&address=mxisd-federation-test@kamax.io

… which yields a 404 as there is no matrix.my-server.org directory in Riot’s web root.

This hinders invitation of the user via email. Invitation via Matrix username (@mxisd-lookup-test:kamax.io) works.

The functionality of the test user is described at: https://github.com/kamax-matrix/mxisd/blob/master/docs/getting-started.md#validate

Steps to reproduce

  1. Create new room via Riot Web
  2. In Riot, open the room and click on "Invite to this room" → modal dialog appears
  3. Open web developer console of your browser. There, go to the network tab
  4. In the input box, enter mxisd-federation-test@kamax.io → invalid web request is sent

Expected: Web request is sent to identity server URL https://matrix.my-server.org/_matrix/identity/api/v1/lookup?medium=email&address=mxisd-federation-test@kamax.io

Configuration

Riot’s config.json:

{
    "default_hs_url": "https://matrix.my-server.org",
    "default_is_url": "https://matrix.my-server.org",
    "disable_custom_urls": true,
    "disable_guests": true,
    "disable_login_language_selector": false,
    "disable_3pid_login": false,
    "brand": "My Server",
    "integrations_ui_url": "",
    "integrations_rest_url": "",
    "integrations_jitsi_widget_url": "",
    "bug_report_endpoint_url": "https://riot.im/bugreports/submit",
    "cross_origin_renderer_url": "https://riot-user-content.my-server.org/v1.html",
    "features": {
        "feature_groups": "labs",
        "feature_pinning": "labs"
    },
    "default_federate": true,
    "default_theme": "light",
    "roomDirectory": {
        "servers": []
    },
    "welcomeUserId": "",
    "piwik": false,
    "enable_presence_by_hs_url": {
        "https://matrix.org": false
    }
}

Excerpt of Synapse’s homeserver.yaml:

public_baseurl: "https://matrix.my-server.org/"
use_presence: false
enable_registration: False
registrations_require_3pid:
  - email
disable_msisdn_registration: True
allow_guest_access: False
default_identity_server: "matrix.my-server.org"
trusted_third_party_id_servers:
  - matrix.my-server.org

Excerpt of MXISD’s mxisd.yaml:

matrix:
  domain: 'my-server.org'
server:
  name: 'matrix.my-server.org'
synapseSql:
  enabled: true
  type: postgresql

Version information

c7hm4r commented 5 years ago

Now, I could fix the described problem by replacing the line …

default_identity_server: "matrix.my-server.org"

… in Synapse’s homeserver.yaml by …

default_identity_server: "https://matrix.my-server.org"

However, I wonder why this value is used. Should not Riot’s default_hs_url override Synapse’s default_identity_server?

The whole process does still not work, but I think this has nothing to do with Riot: MXISD says, Mapping for email:mxisd-federation-test@kamax.io already exists, refusing to store invite, and sends a 400 response to Synapse, which forwards this as a 500 response to Riot.