From 9db3dcfd970581365b3c46ab7b4a9c7ac0f5aaf5 Mon Sep 17 00:00:00 2001 From: Aaron Herman Date: Tue, 24 Jun 2025 08:10:41 -0500 Subject: [PATCH] feat(events): send slack reminder for Security Events with default title --- src/dispatch/case/scheduled.py | 19 ++++++++++++++++--- src/dispatch/messaging/strings.py | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/dispatch/case/scheduled.py b/src/dispatch/case/scheduled.py index 0b88cdba3837..9e28351f9ced 100644 --- a/src/dispatch/case/scheduled.py +++ b/src/dispatch/case/scheduled.py @@ -10,6 +10,7 @@ from datetime import datetime, date from schedule import every from sqlalchemy.orm import Session +from sqlalchemy import or_ from dispatch.decorators import scheduled_project_task, timer from dispatch.project.models import Project @@ -17,6 +18,7 @@ from .enums import CaseStatus from .messaging import send_case_close_reminder, send_case_triage_reminder +from .models import Case from .service import ( get_all_by_status, ) @@ -31,7 +33,9 @@ def case_close_reminder(db_session: Session, project: Project): """Sends a reminder to the case assignee to close out their case.""" cases = get_all_by_status( - db_session=db_session, project_id=project.id, statuses=[CaseStatus.triage] + db_session=db_session, + project_id=project.id, + statuses=[CaseStatus.triage] ) for case in cases: @@ -52,8 +56,17 @@ def case_close_reminder(db_session: Session, project: Project): @scheduled_project_task def case_triage_reminder(db_session: Session, project: Project): """Sends a reminder to the case assignee to triage their case.""" - cases = get_all_by_status( - db_session=db_session, project_id=project.id, statuses=[CaseStatus.new] + + cases = ( + db_session.query(Case) + .filter(Case.project_id == project.id) + .filter( + or_( + Case.title == "Security Event Triage", + Case.status == CaseStatus.new + ) + ) + .all() ) # if we want more specific SLA reminders, we would need to add additional data model diff --git a/src/dispatch/messaging/strings.py b/src/dispatch/messaging/strings.py index a791e7e2c3c4..f6183d29b9bb 100644 --- a/src/dispatch/messaging/strings.py +++ b/src/dispatch/messaging/strings.py @@ -319,7 +319,7 @@ class MessageType(DispatchEnum): ).strip() CASE_TRIAGE_REMINDER_DESCRIPTION = """The status of this case hasn't been updated recently. -Please ensure you triage the case based on its priority.""".replace( +Please ensure you triage the case based on its priority and update its title, priority, severity and tags.""".replace( "\n", " " ).strip()