This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Synapse can return 401 when accessing profile information #8520
Closed
Description
Description
When accessing /_matrix/client/r0/profile/@user:domain:tld
API endpoint, Synapse sometimes returns HTTP 401, which shouldn't be possible according to the Spec.
According to the log, this might be caused by forwarding responses from federation:
2020-10-11 14:17:15,841 - synapse.http.matrixfederationclient - 581 - WARNING - GET-394941 - {GET-O-111777} [conduit.rs] Request failed: GET matrix://conduit.rs/_matrix/federation/v1/query/profile?user_id=%40timo%3Aconduit.rs&field=displayname: HttpResponseException('401: Unauthorized')
2020-10-11 14:17:15,841 - synapse.http.server - 76 - INFO - GET-394941 - <XForwardedForRequest at 0x7f7134cee7b8 method='GET' uri='/_matrix/client/r0/profile/@timo:conduit.rs' clientproto='HTTP/1.0' site=8008> SynapseError: 401 - Unauthorized
2020-10-11 14:17:15,842 - synapse.access.http.8008 - 311 - INFO - GET-394941 - Red.act.ed.IP4 - 8008 - {None} Processed request: 0.038sec/-0.000sec (0.010sec, 0.000sec) (0.000sec/0.000sec/0) 46B 401 "GET /_matrix/client/r0/profile/@timo:conduit.rs HTTP/1.0" "Python/3.8 aiohttp/3.6.2" [0 dbevts]
Some clients misunderstand this as an authentication token rejection, logging the user out.
Steps to reproduce
curl -D - 'https://matrix.org/_matrix/client/r0/profile/@timo:conduit.rs'
(This endpoint is not authenticated, so this should work.)
Expected result: Either returning HTTP 200 with the response, or falling back to HTTP 404, not to confuse clients.
Version information
- Homeserver: Log above is from from dolujeme.eu, but seems to work even on matrix.org.
If not matrix.org:
- Version: 1.20.1 (according to
pip freeze
) - Install method: pip
- Platform: Debian
Additional information
There are some database errors regarding the request as well, snippet is here. But that is probably unrelated / worth separate issue.