ma1uta / ma1sd

Federated Matrix Identity Server (formerly fork of kamax/mxisd)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Repeated deletion of same token results in error

mrjohnson22 opened this issue · comments

When receiving multiple requests with the same expired token, the account manager for the current session will attempt to delete that token from the database multiple times, once for each request. Only the first attempt will actually delete it, and the following attempts will be no-ops. However, the deletion method expects that a deletion attempt removes exactly 1 entry in the database. This means those extra attempts throw an error of Unexpected row count after DB action: 0.

A way to reproduce this is to add multiple email addresses to your account, and view the Discovery screen in Element Android, which requests GET /_matrix/identity/v2/account for each address, using the same token each time. When that token is expired, the error will be hit and the app will display an error dialog for it.

The solution is to only delete an expired token once.