Project

General

Profile

Actions

Bug #13740

open
DM

Wt::Auth::OAuthRedirectEndpoint: possible concurrency issues

Bug #13740: Wt::Auth::OAuthRedirectEndpoint: possible concurrency issues

Added by Dries Mys over 1 year ago. Updated 14 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
05/15/2025
Due date:
% Done:

100%

Estimated time:

Description

Normally, each Wt::Auth::OAuthRedirectEndpoint object will not receive multiple requests simultaneously. However, in rare cases (e.g. in case of connectivity issues), multiple redirects may be received simultaneously. This may result in a crash, as the Wt::Auth::OAuthRedirectEndpoint::handleRequest does not seem to be implemented in a thread safe manner. E.g. handleRequest calls OAuthProcess::requestToken, which destructed the previous Http::Client. Hence, while one thread is still executing the Http::Client::post method, another thread may already destruct the client.

Possible solutions

  • Use proper locking while accessing the OAuthProcess object.
  • Use setTakesUpdateLock to avoid concurrency issues. In the non-popup mode, this should be reasonable, but in case of a popup is used, locking the application may be undesired.

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #1

  • Target version set to 4.12.2

Thanks for the submission, Dries.

I indeed think me way require a custom lock, not the WApplication::UpdateLock, as blocking the UI for a prolonged amount of time may not be desired.

RM Updated by Romain Mardulyn over 1 year ago Actions #2

  • Status changed from New to InProgress
  • Assignee set to Romain Mardulyn

RM Updated by Romain Mardulyn over 1 year ago Actions #3

  • Status changed from InProgress to Review
  • Assignee deleted (Romain Mardulyn)

MV Updated by Matthias Van Ceulebroeck about 1 year ago Actions #4

  • Assignee set to Matthias Van Ceulebroeck

MV Updated by Matthias Van Ceulebroeck about 1 year ago Actions #5

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Matthias Van Ceulebroeck to Romain Mardulyn
  • % Done changed from 0 to 100

RM Updated by Romain Mardulyn 9 months ago Actions #6

  • Status changed from Implemented @Emweb to Closed

DM Updated by Dries Mys 20 days ago Actions #7

@Romain Mardulyn and @Matthias, thank you for the provided fix.

However, I don't think this issue is fully resolved by commit c032095

OAuthProcess::requestToken is now protected from running simultaneously on the same object, but OAuthProcess::handleToken may still run simultaneously with OAuthRedirectEndpoint::handleRequest accessing the same OAuthProcess object.

RM Updated by Romain Mardulyn 14 days ago Actions #8

  • Status changed from Closed to New
  • Assignee deleted (Romain Mardulyn)
  • Target version changed from 4.12.2 to 4.15.1

Thanks for following up on that issue.

I indeed think this issue was not completely solved, so I reopened this ticket.

Actions

Also available in: PDF Atom