Skip to content

Getting unexpected error when trying to validate SPF containing an "exp" modifier #28

@julienfromentc

Description

@julienfromentc

When running the below command:

spf_server = SPF::Server.new
spf_server.process(SPF::Request.new(scope: "mfrom", identity: "example@gatineau.ca", ip_address: "206.123.2.240"))

I am getting the following error:

NoMethodError: undefined method `new' for #<SPF::MacroString:0x0000564e0fca8830>
from /home/user/.rvm/gems/ruby-2.7.4/gems/spf-0.0.54/lib/spf/model.rb:748:in `process'
Caused by SPF::Result::SoftFail: softfail (SPF::Result::SoftFail)
from /home/user/.rvm/gems/ruby-2.7.4/gems/spf-0.0.54/lib/spf/model.rb:1000:in `block in eval'

According the the error, the gem is trying to parse the exp modifier.

I tried to validate the ip address/identity using the spf-check package, and it returned a Pass result, so the issue does not seem to be caused by malformed SPF record.


In case the SPF record of the domain gatineau.ca changes, here are the current SPF records:

gatineau.ca     text =
        "v=spf1 include:spf.cyberimpact.com include:shops.shopify.com include:servers.mcsv.net include:outgoing1.vircom.com ip4:192.69.1.7/32 ip4:207.115.110.7/32 ip4:207.115.110.252/32 ip4:64.254.21.171/32 ip4:206.123.2.240/32 -all"

spf.cyberimpact.com     text =
        "v=spf1 ip4:50.56.176.200 ip4:50.56.187.251 ip4:45.61.49.183 ip4:45.61.49.253 ip4:67.212.92.20 ip4:184.149.61.112 ip4:204.154.174.0/23 ~all exp=spfexp.cyberimpact.com"

spfexp.cyberimpact.com  text =
        "Please see http://www.openspf.org/Why?s=mfrom;id=%{S};ip=%{C};r=%{R}"

shops.shopify.com       text =
        "v=spf1 ip4:35.203.94.235 ip4:35.203.3.51 ~all"

servers.mcsv.net        text =
        "v=spf1 ip4:205.201.128.0/20 ip4:198.2.128.0/18 ip4:148.105.8.0/21 -all"

outgoing1.vircom.com    text =
        "v=spf1 a ip4:207.115.110.0/24 ip4:207.115.106.114 ip4:192.69.1.0/24 ip4:207.96.143.7/32 a:outgoing1.vircom.com a:outgoing2.vircom.com -all"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions