1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 09:39:04 +08:00
osu-lazer/osu.Game/Online/API
Bartłomiej Dach 3006bae0d8
Send client-generated session GUID for identification purposes
This is the first half of a change that *may* fix
https://github.com/ppy/osu/issues/26338 (it definitely fixes *one case*
where the issue happens, but I'm not sure if it will cover all of them).

As described in the issue thread, using the `jti` claim from the JWT
used for authorisation seemed like a decent idea. However, upon closer
inspection the scheme falls over badly in a specific scenario where:

1. A client instance connects to spectator server using JWT A.

2. At some point, JWT A expires, and is silently rotated by the game in
   exchange for JWT B.

   The spectator server knows nothing of this, and continues to only
   track JWT A, including the old `jti` claim in said JWT.

3. At some later point, the client's connection to one of the spectator
   server hubs drops out. A reconnection is automatically attempted,
   *but* it is attempted using JWT B.

   The spectator server was not aware of JWT B until now, and said JWT
   has a different `jti` claim than the old one, so to the spectator
   server, it looks like a completely different client connecting, which
   boots the user out of their account.

This PR adds a per-session GUID which is sent in a HTTP header on every
connection attempt to spectator server. This GUID will be used instead
of the `jti` claim in JWTs as a persistent identifier of a single user's
single lazer session, which bypasses the failure scenario described
above.

I don't think any stronger primitive than this is required. As far as I
can tell this is as strong a protection as the JWT was (which is to say,
not *very* strong), and doing this removes a lot of weird complexity
that would be otherwise incurred by attempting to have client ferry all
of its newly issued JWTs to the server so that it can be aware of them.
2024-07-17 15:56:41 +02:00
..
Requests Avoid ChatAckRequest failures flooding console in OsuGameTestScenes 2024-05-30 17:37:55 +09:00
APIAccess.cs Send client-generated session GUID for identification purposes 2024-07-17 15:56:41 +02:00
APIDownloadRequest.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
APIException.cs Fix remaining obvious CI inspections 2023-06-24 16:07:01 +02:00
APIMessagesRequest.cs Automated pass 2023-06-24 01:00:03 +09:00
APIMod.cs Fix the MOTHERLOAD of undetected issues that are now visible thanks to net6.0 2022-12-16 18:16:26 +09:00
APIRequest.cs Clean up type display for web requests in logs 2023-10-30 15:07:35 +09:00
APIRequestCompletionState.cs Remove redundant nullable suppression directives 2023-06-07 08:20:41 +03:00
ArchiveDownloadRequest.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
DummyAPIAccess.cs Send client-generated session GUID for identification purposes 2024-07-17 15:56:41 +02:00
IAPIProvider.cs Send client-generated session GUID for identification purposes 2024-07-17 15:56:41 +02:00
ModSettingsDictionaryFormatter.cs Update all dependencies (except for Moq) 2023-09-16 15:37:31 +09:00
OAuth.cs Fix broken locking in OAuth 2024-01-30 21:05:23 +01:00
OAuthToken.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
OsuJsonWebRequest.cs Automated pass 2023-06-24 01:00:03 +09:00
OsuWebRequest.cs Automated pass 2023-06-24 01:00:03 +09:00
RegistrationRequest.cs Add API level support for error message and redirect during registration flow 2023-01-13 15:32:53 +09:00