matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.67k stars 664 forks source link

Appservice alias query support is broken #1655

Closed Half-Shot closed 3 years ago

Half-Shot commented 3 years ago

This was broken in https://github.com/matrix-org/dendrite/pull/994. Dendrite does not query appservices when a user requests a unknown alias.

Spec: https://matrix.org/docs/spec/application_service/r0.1.2#get-matrix-app-v1-rooms-roomalias

If dendrite encounters a request to join (either over federation or locally) an alias, and the alias is local but unknown to the homeserver then it should try to query the appservice using the above endpoint. The appservice should then handle the request by either calling createRoom with the given alias, making the alias exist, or send a failed status code where dendrite should then drop the request it was handling with a not found error.

Dendrite will know which appservice to query by the namespaces given in the registration data of the appservice.

Half-Shot commented 3 years ago

Looks like #1660 wasn't enough. Seeing Alias %q not found errors when attempting to join a room that doesn't yet exist. My guess as to the culprit is https://github.com/matrix-org/dendrite/blob/b5aa7ca3ab1c91397700637c91d60860a0535f1e/roomserver%2Finternal%2Fperform%2Fperform_join.go#L132-L133. Presumably because it hits the db via GetRoomIDForAlias rather than going through the code we recently changed to support this.