You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(We had a real-life scenario with our customer's SPF record, which I cannot share in a public space.)
Explanation:
The SPF record for mail1.example.com includes include:mail2.example.com. The record for mail2.example.com includes the macro include:mail.%{d}.abc.xyz which is responsible for the line where the error comes from. The error occurs only when it's called as a nested record; in other words, if you process the request for the mail2.example.com domain directly, the request was processed without error.
When the gem processes a nested record, it creates a new request with the authority_domain as an instance of SPF::MacroString (here and here). When the SPF::MacroString#expand method evaluates the record and finds the d macro, it uses the .authority_domain, which is then concatenated. In the case with nested records, the authority_domain is an instance of SPF::MacroString record, hence the TypeError.
Possible remediation:
By calling .to_s to authority_domain here should fix the problem. (It worked as far as I tested).
Thank you for taking a look at this issue. Let me know if there is anything I can help to release the fix.
The text was updated successfully, but these errors were encountered:
Hello team,
I would like to report a bug where a
TypeError
is raised when nested SPF record contains the%{d}
(aka ) macro.Spec to reproduce:
(We had a real-life scenario with our customer's SPF record, which I cannot share in a public space.)
Explanation:
The SPF record for
mail1.example.com
includesinclude:mail2.example.com
. The record formail2.example.com
includes the macroinclude:mail.%{d}.abc.xyz
which is responsible for the line where the error comes from. The error occurs only when it's called as a nested record; in other words, if you process the request for themail2.example.com
domain directly, the request was processed without error.When the gem processes a nested record, it creates a new request with the
authority_domain
as an instance ofSPF::MacroString
(here and here). When theSPF::MacroString#expand
method evaluates the record and finds thed
macro, it uses the.authority_domain
, which is then concatenated. In the case with nested records, theauthority_domain
is an instance ofSPF::MacroString
record, hence the TypeError.Possible remediation:
By calling
.to_s
to authority_domain here should fix the problem. (It worked as far as I tested).Thank you for taking a look at this issue. Let me know if there is anything I can help to release the fix.
The text was updated successfully, but these errors were encountered: