element-hq / element-hq/synapse

401 Unauthorised /_matrix/client/v3/keys/device_signing/upload when resetting Passkey on mobile clients with SSO

Open
#18,270 2 comments 2 reactions 0 assignees View on GitHub
A-E2EE A-User-Experience O-Occasional S-Major T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

When using recent Synapse versions with SSO, resetting the passkey after the initial login on mobile Element clients (excluding Element X) results in a 401 Unauthorized error. This issue does not occur on the Element web client. In older Versions of Synapse this problem does not seem to exist (tested against Version 1.101.0)

Additional Context:
The issue appears specific to mobile Element clients (excluding Element X) and does not affect the web client.
The 401 response is intentional as part of the flow; the endpoint returns a session ID that must be included in a follow-up request. Its seems that there is some problem between Synapse and the mobile clients when it comes to this second request with a session id.

Impact:
Users on affected mobile clients cannot reset their passkey after SSO login, potentially impacting security configurations and user experience on these platforms.

### Steps to reproduce

The bug can easily be recreated by trying to reset your passkey with the current mobile Element Clients (not Element x) against the matrix.org homeserver.

- Download the Element App from the App Store
- Log in using SSO on a mobile Element client against the matrix.org homeserver (not Element X).
- Attempt to reset the passkey.
- Observe that the request to /_matrix/client/v3/keys/device_signing/upload returns a 401 Unauthorized error.

Expected Behavior:
After receiving a 401 response containing a session ID, the client should attach the session ID to a subsequent request to /_matrix/client/v3/keys/device_signing/upload and successfully complete the passkey reset.

Actual Behavior:
The mobile Element clients do not properly handle the re-submission of the request with the session ID, leading to a persistent 401 Unauthorized error.

https://github.com/user-attachments/assets/20bb36f5-e4b6-4bb4-bf9e-f27f9523ea39

### Homeserver

matrix.org

### Synapse Version

1.126.0

### Installation Method

Docker (matrixdotorg/synapse)

### Database

Postgres

### Workers

Single process

### Platform

Can be recreated using the currently available Element Clients from the app stores and the matrix.org homeserver

### Configuration

_No response_

### Relevant log output

```shell
401 Unauthorised /_matrix/client/v3/keys/device_signing/upload
```

### Anything else that would be useful to know?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the passkey reset flow against Synapse 1.126.0 and compare handling of /_matrix/client/v3/keys/device_signing/upload with version 1.101.0. Trace whether Synapse or the mobile Element client fails to carry the returned session ID; done means identifying a confirmed server-side cause and a regression test or clearly routing the fix to the client project.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, authentication, backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.