From 839c3ff3896917479f3b41c617c20d11e24acf82 Mon Sep 17 00:00:00 2001 From: Stacy Brock Date: Wed, 26 Jun 2024 11:13:08 -0700 Subject: [PATCH] Update filters --- filter-rules.py | 56 +++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/filter-rules.py b/filter-rules.py index 13d4a93..6012ce2 100644 --- a/filter-rules.py +++ b/filter-rules.py @@ -1,12 +1,7 @@ BLOCK_EMAIL = [ - 'chirhart@amazon.com', - 'ron.krogel@citrix.com', - 'lisa@duo.com', - 'replieswelcome@duo.com', - 'webinars@duo.com', + 'support-noreply@status.duosecurity.com', 'alerts@alerts.mail.hpe.com', 'viva-noreply@microsoft.com', - 'jramiro@pagerduty.com', 'info@snowflake.com', 'noreply-marketplace@zoom.us', 'equal.opportunity@oregonstate.edu', @@ -21,14 +16,15 @@ BLOCK_KEYWORDS = [ 'email campaign', 'email preferences', 'end these email updates', - 'manage your preferences', + 'hs-sales-engage.com', 'marketing', 'megacast', - 'modify your preferences', + 'my subscription', 'newsletter', 'no longer would like to be contacted', 'opt-out', 'opt out', + 'pmp exam', 'prefer not to receive', 'prefer not to see', 'rather not receive', @@ -49,6 +45,9 @@ BLOCK_KEYWORDS = [ 'whitepaper', 'wish to be contacted', 'wish to receive', + 'your notifications', + 'your preferences', + 'your subscription', ] BLOCK_DOMAINS = [ @@ -63,6 +62,7 @@ BLOCK_DOMAINS = [ 'exacttarget.com', 'freshsales.io', 'hrciconnect.com', + 'hso.com', 'ikigailabs.io', 'impetus.com', 'informareachmedia.com', @@ -77,6 +77,7 @@ BLOCK_DOMAINS = [ 'norstar.net', 'orjuno.com', 'pphosted.com', + 'qualitynetworks.com', 'radware.com', 'rsmatco.com', 'rubrain.agency', @@ -85,6 +86,7 @@ BLOCK_DOMAINS = [ 'techmate.com', 'thesourcery.com', 'trustedmailservers.com', + 'ubtiinc.com', 'zerowait.com', 'znsrc.com' ] @@ -109,7 +111,6 @@ ALLOW = [ 'github.com', 'osu.atlassian.net', 'oregonstateuniversity.atlassian.net', - 'duo.com', 'sns.amazonaws.com', 'opsgenie.net', 'notify@teamdynamixapp.com', @@ -156,7 +157,7 @@ def filter_message(self, message): 'changes_osu@heliocampus.com', 'no-reply@vmockmail.com', 'noreply-beaverhub@oregonstate.edu', - 'noreply@chatter.salesforce.com' + 'chatter-beaverhub@oregonstate.edu', ] if bool([x for x in automated_sources if(x in normalized_from)]): unactionable = [x.lower() for x in [ @@ -185,7 +186,6 @@ def filter_message(self, message): 'JV required for', 'Changes via Tableau REST API at OSU', 'DSDBTEST', - 'has been assigned to you or your queue', 'VMock CSV S3 Upload', 'Your Daily Digest for Oregon State University' ]] @@ -213,10 +213,20 @@ def filter_message(self, message): move_message(message, 'unactionable') return + # filter Student CRM + if 'noreply-beaverhub@oregonstate.edu' in normalized_from: + unactionable = [ + 'has been assigned to you or your queue', + ] + if is_in_message(unactionable, message): + self._log_result(message, 'moving to unactionable') + move_message(message, 'unactionable') + return + # filter dependabot if 'dependabot[bot]' in str(message.sender): self._log_result(message, 'moving to dependabot') - move_message(message, '99-dependabot') + move_message(message, 'zzz-dependabot') return # filter ACTWON @@ -234,8 +244,8 @@ def filter_message(self, message): # filter HelioCampus helpdesk if 'jira@heliocampus.atlassian.net' in normalized_from: - self._log_result(message, 'moving to 5-hc-helpdesk') - move_message(message, '5-hc-helpdesk') + self._log_result(message, 'moving to zzz-hc-helpdesk') + move_message(message, 'zzz-hc-helpdesk') return # filter alerts-sig @@ -269,11 +279,16 @@ def filter_message(self, message): return # delete Salesforce spam - if ('salesforce.com' in normalized_from - and 'sandbox' in message.subject.lower()): - self._log_result(message, 'deleting salseforce spam') - message.delete() - return + if 'salesforce.com' in normalized_from: + unactionable = [x.lower() for x in [ + 'sandbox', + 'resetting your Salesforce password', + 'new Salesforce security token', + ]] + if is_in_message(unactionable, message): + self._log_result(message, 'deleting salesforce spam') + message.delete() + return # delete Rave junk if ('guardian@getrave.com' in normalized_from @@ -283,7 +298,8 @@ def filter_message(self, message): return # delete conference spam - if 'brocks+conf@onid.oregonstate.edu' in normalized_to: + if ('brock+conf@onid.oregonstate.edu' in normalized_to + or 'brock+conf@oregonstate.edu' in normalized_to): self._log_result(message, 'deleting conference spam') message.delete() return