1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

[PM-5437] Handle client_credentials clientId that is not a valid GUID (#3616)

* Return null if the clientId is not a valid Guid.

* Linting
This commit is contained in:
Todd Martin 2024-03-19 10:21:15 -04:00 committed by GitHub
parent 15eea77d66
commit 611a65e0a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,7 +90,12 @@ public class ClientStore : IClientStore
private async Task<Client> CreateApiKeyClientAsync(string clientId)
{
var apiKey = await _apiKeyRepository.GetDetailsByIdAsync(new Guid(clientId));
if (!Guid.TryParse(clientId, out var guid))
{
return null;
}
var apiKey = await _apiKeyRepository.GetDetailsByIdAsync(guid);
if (apiKey == null || apiKey.ExpireAt <= DateTime.Now)
{