Bug 2552050 - python-authheaders: check_dmarc() sets SPF smtp.mailfrom to None, causing AttributeError
Summary: python-authheaders: check_dmarc() sets SPF smtp.mailfrom to None, causing Att...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-authheaders
Version: 44
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Neal Gompa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-10-14 01:24 UTC by Jeffrey Ross
Modified: 2026-11-23 21:20 UTC (History)
5 users (show)

Fixed In Version: python-authheaders-0.16.3-10.fc46
Clone Of:
Environment:
Last Closed: 2026-11-23 20:59:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Sanitized Python reproduction and traceback (4.46 KB, text/plain)
2026-10-14 01:24 UTC, Jeffrey Ross
no flags Details

Description Jeffrey Ross 2026-10-14 01:24:38 UTC
Created attachment 2161069 [details]
Sanitized Python reproduction and traceback

Description of problem:

The authheaders DMARC checker modifies a previously valid SPF authentication result when smtp.mailfrom contains a bare domain rather than a full email address.

For example:

spf=pass smtp.mailfrom=optonline.net

Calling check_dmarc() changes the SPF smtp.mailfrom property from 'optonline.net' to None.

When the Authentication-Results header is subsequently serialized, authres raises:

AttributeError: 'NoneType' object has no attribute 'quote_if_needed'

This caused Mailman 3 to shunt legitimate mailing-list messages.

Version-Release number of selected component:

python3-authheaders-0.16.3-7.fc44.noarch
python3-authres-1.2.0-28.fc44.noarch
mailman3-3.3.10-3.fc44.noarch
Python 3.14
Fedora 44

How reproducible:

Reproduced consistently using a standalone Python script without running Mailman.

Steps to Reproduce:

1. Parse an Authentication-Results header containing:
   spf=pass smtp.mailfrom=optonline.net

2. Call authheaders.check_dmarc() with the parsed SPF and DKIM results.

3. Observe that the SPF smtp.mailfrom property changes from 'optonline.net' to None.

4. Serialize the original AuthenticationResultsHeader object using str(ar).

Actual results:

SPF before: 'optonline.net'
DMARC result: pass
SPF after: None
INVALID PROPERTY: spf smtp mailfrom

Serialization fails with:
AttributeError: 'NoneType' object has no attribute 'quote_if_needed'

Expected results:

The DMARC checker should accept an existing bare-domain SPF smtp.mailfrom value without corrupting the SPF result. Authentication-Results serialization should succeed.

Suspected cause:

In authheaders/__init__.py, dmarc_per_from() calls get_domain_part() on the existing SPF smtp.mailfrom value and unconditionally assigns the result back to spf_result.smtp_mailfrom.

When the original value is already a bare domain, the resulting None overwrites the valid SPF property.

Workaround:

Setting dmarc: no under Mailman's [ARC] configuration prevents the exception. Exim continues to perform SPF, DKIM, and DMARC authentication independently.

A sanitized standalone reproduction script is attached.

Comment 1 Jeffrey Ross 2026-10-14 17:42:33 UTC
An upstream fix appears to address this issue:

https://github.com/ValiMail/authentication-headers/pull/37

Patch:
https://github.com/ValiMail/authentication-headers/compare/715f29471245ec3474b074c2d431a360431a3e7a..2298a7e3c81dec33ed5fbdddf3a8d89e0f00ffe7

The patch changes `authheaders/__init__.py` line 236 from:

`if '@' in mail_from_domain:`

to:

`if mail_from_domain is not None and '@' in mail_from_domain:`

This prevents an exception when an existing SPF result has no `smtp.mailfrom` property.

The upstream tests also cover an existing SPF result with a bare-domain `smtp.mailfrom`, matching the scenario encountered with Mailman 3 on Fedora 44.

Please consider backporting this fix to the Fedora 44 `python3-authheaders` package.

Comment 2 Kevin Fenzi 2026-11-23 20:51:24 UTC
Building now with the patch. Thanks for the report and pointers.

Comment 3 Fedora Update System 2026-11-23 20:55:04 UTC
FEDORA-2026-470b2b71eb (python-authheaders-0.16.3-10.fc46) has been submitted as an update to Fedora 46.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-470b2b71eb

Comment 4 Fedora Update System 2026-11-23 20:59:54 UTC
FEDORA-2026-470b2b71eb (python-authheaders-0.16.3-10.fc46) has been pushed to the Fedora 46 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2026-11-23 21:20:04 UTC
FEDORA-2026-4979c7fe63 (python-authheaders-0.16.3-10.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-4979c7fe63

Comment 6 Fedora Update System 2026-11-23 21:20:05 UTC
FEDORA-2026-06d6e2b631 (python-authheaders-0.16.3-10.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-06d6e2b631


Note You need to log in before you can comment on or make changes to this bug.