diff --git a/CHANGELOG.md b/CHANGELOG.md index cbd2dfc..30c60c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Collector (HEC) - Use a browser-like `User-Agent` when downloading the Public Suffix List, to avoid being blocked by security proxies - Reduce default DNS timeout to 0.5 seconds +- Add alignment booleans to JSON output 3.9.7 ----- diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index 88f991e..7f3fc0e 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -350,6 +350,12 @@ def _parse_report_record(record, nameservers=None, timeout=0.5): if "spf" in policy_evaluated: new_policy_evaluated["spf"] = policy_evaluated["spf"] reasons = [] + spf_aligned = policy_evaluated["spf"] == "pass" + dkim_aligned = policy_evaluated["dkim"] == "pass" + dmarc_aligned = spf_aligned or dkim_aligned + new_record["alignment"]["spf"] = spf_aligned + new_record["alignment"]["dkim"] = dkim_aligned + new_record["alignment"]["dmarc"] = dmarc_aligned if "reason" in policy_evaluated: if type(policy_evaluated["reason"]) == list: reasons = policy_evaluated["reason"]