Skip to content

Commit

Permalink
Merge pull request #25 from CybercentreCanada/improvements/email_doma…
Browse files Browse the repository at this point in the history
…in_confusion

Filter out email domains from being applied to badlist
  • Loading branch information
cccs-rs authored Jun 26, 2024
2 parents 8da6938 + 4f4fefa commit 295aad5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions badlist/badlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ def execute(self, request):
tags[f"network.static.{net_type}"].append(request.task.fileinfo.uri_info.hostname)
tags[f"network.dynamic.{net_type}"].append(request.task.fileinfo.uri_info.hostname)

# Filter out email domains from network domains before checking blocklist for hits
email_domains = set([x.split("@", 1)[1] for x in tags.get("network.email.address", [])])
tags["network.static.domain"] = list(set(tags["network.static.domain"]) - email_domains)
tags["network.dynamic.domain"] = list(set(tags["network.dynamic.domain"]) - email_domains)

# Check the list of tags as a batch
badlisted_tags = self.api_interface.lookup_badlist_tags(request.task.tags)
for badlisted in badlisted_tags:
Expand Down

0 comments on commit 295aad5

Please sign in to comment.