Skip to content

BUGFIX: Fix SPF parsing of qualified mechanisms like +mx#4062

Merged
tlimoncelli merged 1 commit intoStackExchange:mainfrom
cafferata:bugfix/regression-in-spf-builder-using-mx
Feb 10, 2026
Merged

BUGFIX: Fix SPF parsing of qualified mechanisms like +mx#4062
tlimoncelli merged 1 commit intoStackExchange:mainfrom
cafferata:bugfix/regression-in-spf-builder-using-mx

Conversation

@cafferata
Copy link
Copy Markdown
Collaborator

Fixes a regression where SPF_BUILDER with overflow rejected valid RFC 7208 qualified mechanisms like +mx, ~mx, ?a, etc. with the error unsupported SPF part mx. The root cause was that lcpart (the lowercase comparison variable) was created before stripping the qualifier prefix (+,-,~,?), so HasPrefix checks against "mx" or "a" failed when the string was still "+mx" or "+a". Qualifiers on mechanisms are valid per RFC 7208 Section 4.7. A regression test covering all qualifier/mechanism combinations has been added.

Fixes #4042

@cafferata
Copy link
Copy Markdown
Collaborator Author

Ping @grahammiln, @tlimoncelli.

…ge#4042)

- The `lcpart` variable was created before stripping the qualifier (`+`,`-`,`~`,`?`), causing `HasPrefix` checks to fail for mechanisms like "+mx" or "+a" when used with `SPF_BUILDER's` overflow option.
@cafferata cafferata force-pushed the bugfix/regression-in-spf-builder-using-mx branch from 4091319 to 680dae6 Compare February 10, 2026 08:12
@tlimoncelli
Copy link
Copy Markdown
Contributor

Ah! So much better! Thank you for digging into that to figure out what was wrong.

@tlimoncelli tlimoncelli merged commit d77c263 into StackExchange:main Feb 10, 2026
5 checks passed
@cafferata cafferata deleted the bugfix/regression-in-spf-builder-using-mx branch February 10, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in SPF_BUILDER using +mx

2 participants