ma1uta / ma1sd

Federated Matrix Identity Server (formerly fork of kamax/mxisd)
GNU Affero General Public License v3.0
167 stars 55 forks source link

Repeated deletion of same token results in error #79

Open mrjohnson22 opened 3 years ago

mrjohnson22 commented 3 years ago

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.