From 051e7c55e966fe5672058c6c4450cd791cf74286 Mon Sep 17 00:00:00 2001 From: David Whittaker <84562015+whitdog47@users.noreply.github.com> Date: Fri, 8 Nov 2024 09:03:05 -0800 Subject: [PATCH] Check if challenge is already approved before raising exception (#5445) --- src/dispatch/plugins/dispatch_core/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dispatch/plugins/dispatch_core/plugin.py b/src/dispatch/plugins/dispatch_core/plugin.py index 1bb18284799e..ec3db480c076 100644 --- a/src/dispatch/plugins/dispatch_core/plugin.py +++ b/src/dispatch/plugins/dispatch_core/plugin.py @@ -379,6 +379,9 @@ def validate_mfa_token( raise ActionMismatchError("Action mismatch") if not challenge.valid: raise ExpiredChallengeError("Challenge is no longer valid") + if challenge.status == MfaChallengeStatus.APPROVED: + # Challenge has already been approved + return challenge.status if challenge.status != MfaChallengeStatus.PENDING: raise InvalidChallengeStateError(f"Challenge is in invalid state: {challenge.status}")