Skip to content

MSC4108 2024 version (Sign in with QR code): clock desynchronisation between client and homeserver causes rendezvous session to be immediately deleted and the login to fail #5141

@reivilibre

Description

@reivilibre

As diagnosed with a community member in the MAS room.

The root cause is that the HTTP Expires header is being read for an absolute timestamp, yet the client and server may have desynchronised clocks.

If the server is a minute or more slower than the client, the rendezvous session will be immediately DELETEd causing the sign-in to fail.

I'm told that Element X shows the error 'Something went wrong An unexpected error occurred. Please try again' in this case.

This section of code appears to be at fault:

const expires = res.headers.get("expires");
if (expires) {
if (this.expiresTimer) {
clearTimeout(this.expiresTimer);
this.expiresTimer = undefined;
}
this.expiresAt = new Date(expires);
this.expiresTimer = setTimeout(() => {
this.expiresTimer = undefined;
this.cancel(ClientRendezvousFailureReason.Expired);
}, this.expiresAt.getTime() - Date.now());

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions