"""
return publicsuffix2.PublicSuffixList()
+ def obfuscate_name(self, name):
+ """
+ Takes a name and obfuscates it so it can be sent over email
+ """
+ if name is None:
+ return None
+
+ # Find the TLD
+ tld = self.psl.get_tld(name, strict=True)
+
+ # If we cannot identify the TLD, we cannot continue
+ if not tld:
+ return name
+
+ # Remove the suffix
+ name = name.removesuffix(".%s" % tld)
+
+ # Put everything back together again
+ return "%s[.]%s" % (name, tld)
+
@functools.cached_property
def auth(self):
return auth.Auth(self)
# List all reports
for report in sorted(lists[list]):
+ # Obfuscate the name
+ name = self.backend.obfuscate_name(report.name)
+
if report.block:
- headline = _("%s should be blocked") % report.name
+ headline = _("%s should be blocked") % name
else:
- headline = _("%s should be allowed") % report.name
+ headline = _("%s should be allowed") % name
# Add the headline
lines.append(" * %s" % headline)
if not reporter:
return
+ # Obfuscate the name
+ name = self.backend.obfuscate_name(self.name)
+
# Compose the body
lines = (
_("Hello,"),
"",
_("Thank you for submitting a report to the IPFire DBL service."),
"",
- _("We have received your report regarding %s and wanted to confirm that it's now in our moderation queue.") % self.name,
+ _("We have received your report regarding %s and wanted to confirm that it's now in our moderation queue.") % name,
"",
_("Our moderation team will carefully review your submission and you'll receive an update via email"
" once a decision has been made. Please note that review times may vary depending on the volume of reports we receive."),
if not sender:
raise RuntimeError("Failed to fetch the sender '%s'" % self.closed_by)
+ # Obfuscate the name
+ name = self.backend.obfuscate_name(self.name)
+
# ACCEPTED
if self.accepted:
- subject = "[IPFire DBL] %s" % (_("Your report for %s has been accepted") % self.name)
+ subject = "[IPFire DBL] %s" % (_("Your report for %s has been accepted") % name)
lines = (
_("Hello,"),
"",
- _("Thank you for taking the time to report %s to our IPFire DBL service.") % self.name,
+ _("Thank you for taking the time to report %s to our IPFire DBL service.") % name,
"",
_("We've reviewed your submission and are pleased to inform you that your report has been ACCEPTED."
" The domain has been added to our blocklist and will now be flagged by systems using our service."),
# DECLINED
else:
- subject = "[IPFire DBL] %s" % (_("Your report for %s has been reviewed") % self.name)
+ subject = "[IPFire DBL] %s" % (_("Your report for %s has been reviewed") % name)
lines = (
_("Hello,"),
"",
- _("Thank you for taking the time to report %s to our IPFire DBL service.") % self.name,
+ _("Thank you for taking the time to report %s to our IPFire DBL service.") % name,
"",
_("We've carefully reviewed your submission."
" After investigation, we've determined that this domain does not meet our criteria"