Closed adamlc closed 11 months ago
Interesting. It appears the parser is parsing the missing value as a ""
.
pp SPF::Query::Parser.new.parse("v=spf1 a mx ip4:0.0.0.0 ~all")
{:version=>"spf1"@2,
:rules=>
[{:directive=>{:name=>"a"@7, :value=>""}},
{:directive=>{:name=>"mx"@9, :value=>""}},
{:directive=>{:name=>"ip4"@12, :value=>{:ip=>"0.0.0.0"@16}}},
{:directive=>{:qualifier=>"~"@24, :name=>"all"@25}}]}
I guess that could be the issue! Is it easy to resolve?
Appears to be in the dual_cidr_length
rule:
rule(:dual_cidr_length) do
ipv4_cidr_length.maybe >> (str('/') >> ipv6_cidr_length).maybe
end
rule(:ipv4_cidr_length) { str('/') >> digit.repeat(1).as(:cidr_length) }
rule(:ipv6_cidr_length) { str('/') >> digit.repeat(1).as(:cidr_length) }
parser.dual_cidr_length.parse("")
# => ""
I've noticed an issue when parsing a particular record. In my client's DNS his current SPF record is (with blanked out IP):
But for some reason spf-query is returning the following:
It appears to be adding a semi colon after the a and mx parts, which is actually an invalid record!