[GH-ISSUE #2974] Failure to process DMARC reports with empty email in report_metadata #1638

Open
opened 2026-02-27 11:18:16 +03:00 by kerem · 1 comment
Owner

Originally created by @tschuettler on GitHub (Jul 18, 2022).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2974

The current model understandably can't handle DMARC reports where the email is empty since the email is supposed to be not null and unique and is used to retrieve the reporter id: github.com/modoboa/modoboa-dmarc@3e21a93de4/modoboa_dmarc/lib.py (L96)

<?xml version="1.0" encoding="UTF-8" ?>
<feedback>
 <report_metadata>
  <org_name>synaq.com</org_name>
  <email></email>
  <report_id>example.com:1657845753</report_id>
  <date_range>
   <begin>1657749600</begin>
   <end>1657836000</end>
  </date_range>

While perhpaps not intended by the specification, the xml-schema of that part of the report is valid according to https://dmarc.org/dmarc-xml/0.1/rua.xsd as far as I understand that. It requires a element type of string, but does not require it to have a length > 0 or even be a proper email address.

For completeness here is an excerpt of the traceback:

File "/srv/modoboa/env/lib/python3.8/site-packages/django/db/models/query.py", line 538, in get_or_create return self.get(**kwargs), False
File "/srv/modoboa/env/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get raise self.model.DoesNotExist( modoboa_dmarc.models.DoesNotExist: Reporter matching query does not exist.
During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "/srv/modoboa/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.errors.NotNullViolation: null value in column "email" violates not-null constraint DETAIL: Failing row contains (151, synaq.com, null).
The above exception was the direct cause of the following exception: Traceback (most recent call last):
File "/srv/modoboa/instance/manage.py", line 21, in main()
File "/srv/modoboa/instance/manage.py", line 17, in main execute_from_command_line(sys.argv)
[..]

I tried to contact synaq.com some time ago, but have not seen any reaction from them yet. In contrast to earlier DMARC reports they even changed their report emails not to have a from email address or even a return-path, most likely to stop getting bounced dmarc reports. In our instance I have never observed this issue by anyone else but synaq.com.

Perhaps we can relax those requirements and check for the organisation name if there is no email address or we could create a catch all organization were all reports without an email would show up.

Originally created by @tschuettler on GitHub (Jul 18, 2022). Original GitHub issue: https://github.com/modoboa/modoboa/issues/2974 The current model understandably can't handle DMARC reports where the email is empty since the email is supposed to be not null and unique and is used to retrieve the reporter id: https://github.com/modoboa/modoboa-dmarc/blob/3e21a93de4fd88b2a1fca7c019f96a4e00f3d01b/modoboa_dmarc/lib.py#L96 ``` xml <?xml version="1.0" encoding="UTF-8" ?> <feedback> <report_metadata> <org_name>synaq.com</org_name> <email></email> <report_id>example.com:1657845753</report_id> <date_range> <begin>1657749600</begin> <end>1657836000</end> </date_range> ``` While perhpaps not intended by the specification, the xml-schema of that part of the report is valid according to https://dmarc.org/dmarc-xml/0.1/rua.xsd as far as I understand that. It requires a element type of string, but does not require it to have a length > 0 or even be a proper email address. For completeness here is an excerpt of the traceback: > File "/srv/modoboa/env/lib/python3.8/site-packages/django/db/models/query.py", line 538, in get_or_create return self.get(**kwargs), False File "/srv/modoboa/env/lib/python3.8/site-packages/django/db/models/query.py", line 406, in get raise self.model.DoesNotExist( modoboa_dmarc.models.DoesNotExist: Reporter matching query does not exist. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/modoboa/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.errors.NotNullViolation: null value in column "email" violates not-null constraint DETAIL: Failing row contains (151, synaq.com, null). The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/srv/modoboa/instance/manage.py", line 21, in <module> main() File "/srv/modoboa/instance/manage.py", line 17, in main execute_from_command_line(sys.argv) [..] > I tried to contact synaq.com some time ago, but have not seen any reaction from them yet. In contrast to earlier DMARC reports they even changed their report emails not to have a from email address or even a return-path, most likely to stop getting bounced dmarc reports. In our instance I have never observed this issue by anyone else but synaq.com. Perhaps we can relax those requirements and check for the organisation name if there is no email address or we could create a catch all organization were all reports without an email would show up.
Author
Owner

@kryskool commented on GitHub (Feb 5, 2026):

In this case we can

  1. Reject when no email
  2. Replace by postmaster@domain.tld when empty

@tonioo what do you think ?

<!-- gh-comment-id:3855742419 --> @kryskool commented on GitHub (Feb 5, 2026): In this case we can 1. Reject when no email 2. Replace by postmaster@domain.tld when empty @tonioo what do you think ?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1638
No description provided.