element-hq / element-hq/synapse
Incorrect HTML responses when providing possibly non existent matrix identifiers
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 607
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#15392](https://github.com/matrix-org/synapse/issues/15392).
---
### Description
Calling APIs with (possibly) non existent matrix identifiers (like: `@alfotest:some`) triggers non json responses from the home server with HTTP errors 502.
Examples of such APIs are:
- [Get profile](https://spec.matrix.org/v1.6/client-server-api/#get_matrixclientv3profileuserid)
- [Create Room](https://spec.matrix.org/v1.6/client-server-api/#post_matrixclientv3createroom)(with at least one invited user)
- [Invite](https://spec.matrix.org/v1.6/client-server-api/#post_matrixclientv3roomsroomidinvite)
⚠️ The issue is particularly serious with the create room API (eg. with "invite": [`@alfotest:some`]) since even if the clients gets back an HTTP 502 and a HTML response, the room creation actually succeeds.
### Steps to reproduce
- Open https://matrix-client.matrix.org/_matrix/client/v3/profile/@alfotest21:some
### Homeserver
matrix.org
### Synapse Version
{"server_version":"1.80.0 (b=matrix-org-hotfixes,ab0a5f1972,dirty)","python_version":"3.8.12"}
### Installation Method
I don't know
### Database
I don't know
### Workers
I don't know
### Platform
I don't know
### Configuration
I don't know
### Relevant log output
```shell
None
```
### Anything else that would be useful to know?
_No response_
Contributor guide
Research direction
Start by reproducing the profile request for @alfotest21:some, then compare the Get profile, Create Room with an invited user, and Invite API entry points. Trace how a possibly nonexistent Matrix identifier produces the HTTP 502 and HTML response; done means these APIs return the appropriate Matrix API response and do not report room creation as failed when it succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100