1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Fix: update queries to only return the most recent authrequest, or none at all if the most recent is approved.

This commit is contained in:
Ike Kottlowski
2025-06-11 15:49:43 -04:00
parent e7302862dc
commit 5d251d77e0
4 changed files with 20 additions and 36 deletions

View File

@ -11,12 +11,12 @@ BEGIN
AR.*,
ROW_NUMBER() OVER (PARTITION BY RequestDeviceIdentifier ORDER BY CreationDate DESC) AS rn
FROM dbo.AuthRequestView AR
WHERE Type IN (0, 1)
WHERE Type IN (0, 1) -- 0 = UnlockAndAUth, 1 = unlock
AND AR.CreationDate >= DATEADD(MINUTE, -@ExpirationMinutes, GETUTCDATE())
AND AR.UserId = @UserId
AND AR.Approved IS NULL
)
SELECT PR.*
FROM PendingRequests PR
WHERE rn = 1;
WHERE rn = 1
AND PR.Approved IS NULL;
END;