From 21180f4bb84a9bc4a77e5705ab60fb52229d2743 Mon Sep 17 00:00:00 2001 From: Sean Whalen <44679+seanthegeek@users.noreply.github.com> Date: Tue, 3 Sep 2024 08:37:19 -0400 Subject: [PATCH] 8.14.0 release - Fix processing of SMTP-TLS reports (#549) - Skip invalid aggregate report rows without calling the whole report invalid - Some providers such as GoDaddy will send reports with some rows missing a source IP address, while other rows are fine - Fix Dovecot support by using the seperator provided by the IPMAP namespace when possible (PR #552 closes #551) - Only download `base_reverse_dns_map.csv` once (fixes #542) - Update included `base_reverse_dns_map.csv` - Replace University category with Education to be more inclusive - Update included `dbip-country-lite.mmdb` --- CHANGELOG.md | 1 + parsedmarc/__init__.py | 13 ++++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dfc868..044e3fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog 8.14.0 ------ +- Fix processing of SMTP-TLS reports (#549) - Skip invalid aggregate report rows without calling the whole report invalid - Some providers such as GoDaddy will send reports with some rows missing a source IP address, while other rows are fine - Fix Dovecot support by using the seperator provided by the IPMAP namespace when possible (PR #552 closes #551) diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index 304fb8d..c104fe7 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -597,18 +597,13 @@ def extract_report(input_): str: The extracted text """ - def is_base64(s): - base64_regex = re.compile(r'^[A-Za-z0-9+/=]+\Z') - return bool(base64_regex.match(s)) - try: file_object = None if isinstance(input_, str): - if is_base64(input_): - try: - file_object = BytesIO(b64decode(input_)) - except binascii.Error: - pass + try: + file_object = BytesIO(b64decode(input_)) + except binascii.Error: + pass else: file_object = open(input_, "rb") elif type(input_) is bytes: