From 14074e1e339fae35a954e8367e0d346f41e58ebb Mon Sep 17 00:00:00 2001 From: Todd Martin <106564991+trmartin4@users.noreply.github.com> Date: Mon, 31 Oct 2022 21:31:07 -0400 Subject: [PATCH] [SG-701] Updated controller to not send notification if request was denied (#2375) * Updated controller to not send response if request was denied. * Linting --- src/Api/Controllers/AuthRequestsController.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Api/Controllers/AuthRequestsController.cs b/src/Api/Controllers/AuthRequestsController.cs index f8a4cf7ec..24547ef1f 100644 --- a/src/Api/Controllers/AuthRequestsController.cs +++ b/src/Api/Controllers/AuthRequestsController.cs @@ -142,7 +142,13 @@ public class AuthRequestsController : Controller authRequest.ResponseDate = DateTime.UtcNow; authRequest.Approved = model.RequestApproved; await _authRequestRepository.ReplaceAsync(authRequest); - await _pushNotificationService.PushAuthRequestResponseAsync(authRequest); + + // We only want to send an approval notification if the request is approved (or null), + // to not leak that it was denied to the originating client if it was originated by a malicious actor. + if (authRequest.Approved ?? true) + { + await _pushNotificationService.PushAuthRequestResponseAsync(authRequest); + } return new AuthRequestResponseModel(authRequest, _globalSettings.BaseServiceUri.Vault); }