From 2dfc3aae2018a3d3264d5ddfa6535c7dbface41f Mon Sep 17 00:00:00 2001 From: Will Sheldon <114631109+wssheldon@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:33:45 -0700 Subject: [PATCH] Adds a note to the engagement initial modal to have MFA device ready to avoid timeout (#3845) --- .../dispatch_slack/case/interactive.py | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/interactive.py b/src/dispatch/plugins/dispatch_slack/case/interactive.py index a49ad567497b..dd43e16ca54b 100644 --- a/src/dispatch/plugins/dispatch_slack/case/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/case/interactive.py @@ -1519,17 +1519,39 @@ def engagement_button_approve_click( ).build() return client.views_open(trigger_id=body["trigger_id"], view=modal) + engagement = signal_service.get_signal_engagement( + db_session=db_session, + signal_engagement_id=context["subject"].engagement_id, + ) + + mfa_plugin = plugin_service.get_active_instance( + db_session=db_session, project_id=context["subject"].project_id, plugin_type="auth-mfa" + ) + mfa_enabled = True if mfa_plugin and engagement.require_mfa else False + + blocks = [ + Section(text="Confirm that this is expected and that it is not suspicious behavior."), + Divider(), + description_input(label="Additional Context", optional=False), + ] + + if mfa_enabled: + blocks.append(Section(text=" ")) + blocks.append( + Context( + elements=[ + "After submission, you will be asked to confirm a Multi-Factor Authentication (MFA) prompt, please have your MFA device ready." + ] + ), + ) + modal = Modal( submit="Submit", close="Cancel", title="Confirmation", callback_id=SignalEngagementActions.approve_submit, private_metadata=context["subject"].json(), - blocks=[ - Section(text="Confirm that this is expected and that it is not suspicious behavior."), - Divider(), - description_input(label="Additional Context", optional=False), - ], + blocks=blocks, ).build() client.views_open(trigger_id=body["trigger_id"], view=modal)