1
0
mirror of https://github.com/bitwarden/server synced 2026-01-02 08:33:48 +00:00

fix(auth-validator): [PM-22975] Client Version Validator - Made enough changes so that it's ready for review by KM

This commit is contained in:
Patrick Pimentel
2025-12-02 14:22:17 -05:00
parent 8b8694e589
commit ed89cf8161
7 changed files with 40 additions and 47 deletions

View File

@@ -25,11 +25,14 @@ public class ClientVersionValidator(
return true;
}
Version clientVersion = currentContext.ClientVersion;
Version? clientVersion = currentContext.ClientVersion;
Version? minVersion = await getMinimumClientVersionForUserQuery.Run(user);
// Allow through if headers are missing.
if (minVersion == null)
// The minVersion should never be null because of where this validator is run. The user would
// have been determined to be null prior to reaching this point, but it is defensive programming
// to check for nullish values in case validators were to ever be reordered.
if (clientVersion == null || minVersion == null)
{
return true;
}