mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-07-16 21:44:56 +00:00
Fix crash when parsing report with empty <auth_results></auth_results>
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
3.5.1
|
||||
-----
|
||||
|
||||
- Fix dashboard message counts for source IP addresses visualizations
|
||||
- Improve dashboard loading times
|
||||
- Improve dashboard layout
|
||||
- Add country rankings to the dashboards
|
||||
- Fix crash when parsing report with empty <auth_results></auth_results>
|
||||
|
||||
|
||||
3.5.0
|
||||
-----
|
||||
- Use Cloudflare's public DNS resolvers by default instead of Google's
|
||||
|
||||
@@ -42,7 +42,7 @@ import imapclient.exceptions
|
||||
import dateparser
|
||||
import mailparser
|
||||
|
||||
__version__ = "3.5.0"
|
||||
__version__ = "3.5.1"
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.INFO)
|
||||
@@ -351,7 +351,10 @@ def _parse_report_record(record, nameservers=None, timeout=6.0):
|
||||
new_record["policy_evaluated"] = new_policy_evaluated
|
||||
new_record["identifiers"] = record["identifiers"].copy()
|
||||
new_record["auth_results"] = OrderedDict([("dkim", []), ("spf", [])])
|
||||
auth_results = record["auth_results"].copy()
|
||||
if record["auth_results"] is not None:
|
||||
auth_results = record["auth_results"].copy()
|
||||
else:
|
||||
auth_results = new_record["auth_results"].copy()
|
||||
if "dkim" in auth_results:
|
||||
if type(auth_results["dkim"]) != list:
|
||||
auth_results["dkim"] = [auth_results["dkim"]]
|
||||
@@ -492,7 +495,8 @@ def parse_aggregate_report_xml(xml, nameservers=None, timeout=6.0):
|
||||
except KeyError as error:
|
||||
raise InvalidAggregateReport("Missing field: "
|
||||
"{0}".format(error.__str__()))
|
||||
|
||||
except AttributeError:
|
||||
raise InvalidAggregateReport("Report missing required section")
|
||||
|
||||
def extract_xml(input_):
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?>
|
||||
<feedback>
|
||||
<version>1.0</version>
|
||||
<report_metadata>
|
||||
<org_name>example.net</org_name>
|
||||
<email>postmaster@example.net</email>
|
||||
<report_id>b043f0e264cf4ea995e93765242f6dfb</report_id>
|
||||
<date_range>
|
||||
<begin>1529366400</begin>
|
||||
<end>1529452799</end>
|
||||
</date_range>
|
||||
</report_metadata>
|
||||
<policy_published>
|
||||
<domain>example.com</domain>
|
||||
<adkim>r</adkim>
|
||||
<aspf>r</aspf>
|
||||
<p>none</p>
|
||||
<sp>none</sp>11
|
||||
<pct>100</pct>
|
||||
<fo>0</fo>
|
||||
</policy_published>
|
||||
<record>
|
||||
<row>
|
||||
<source_ip>199.230.200.36</source_ip>
|
||||
<count>1</count>
|
||||
<policy_evaluated>
|
||||
<disposition>none</disposition>
|
||||
<dkim>fail</dkim>
|
||||
<spf>fail</spf>
|
||||
</policy_evaluated>
|
||||
</row>
|
||||
<identifiers>
|
||||
<envelope_from>example.com</envelope_from>
|
||||
<header_from>example.com</header_from>
|
||||
</identifiers>
|
||||
<auth_results>
|
||||
</auth_results>
|
||||
</record>
|
||||
</feedback>
|
||||
Reference in New Issue
Block a user