Skip to content

OAuth token refresh race-condition #10140

@alecpl

Description

@alecpl

Because in Roundcube we allow multiple concurrent http requests at the same time we end up with a race-condition that leads to a session breakage when refreshing OAuth token.

It is a know best practice in OAuth to rotate refresh tokens by revoking the old one and issuing a new one with each access token refresh. Consider two http requests at (almost) the same time:

  1. First request reads session (with oauth token)
  2. Second request reads session (with oauth token)
  3. First request refreshes the token and finishes (storing the new token in session)
  4. Second request attempts to refresh the token, but it will fail because the refresh token got revoked. Session will get killed.

How big of a problem it is depends on the token expiration time - how often the refresh happens, and how often users get into UIs that are more likely to use simultaneous requests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions