MediumGHSA-7mr7-4f54-vcx5CVE-2024-51987

HTTP Client uses incorrect token after refresh

Published 7 Nov 2024 · Updated 8 Nov 2024

Is your project on an affected Duende.AccessTokenManagement.OpenIdConnect?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several .NET apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
>=3.0.0 <3.0.1
Fixed in
3.0.1
Update to the fixed version for your release line, for example:dotnet add package Duende.AccessTokenManagement.OpenIdConnect --version 3.0.1

Details

Impact

HTTP Clients created by AddUserAccessTokenHttpClient may use a different user's access token after a token refresh. This occurs because a refreshed token will be captured in pooled HttpClient instances, which may be used by a different user.

Workarounds

Instead of using AddUserAccessTokenHttpClient to create an HttpClient that automatically adds a managed token to outgoing requests, you can use the HttpConext.GetUserAccessTokenAsync extension method or the IUserTokenManagementService.GetAccessTokenAsync method.

Patches

This issue is fixed in Duende.AccessTokenManagement.OpenIdConnect 3.0.1.

Is GHSA-7mr7-4f54-vcx5 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected Duende.AccessTokenManagement.OpenIdConnect, and gives you the command that fixes it.

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.