Summary

  • RFC 7208, April 2014, Standards Track, describes version 1 of the Sender Policy Framework: domains "can explicitly authorize the hosts that are allowed to use their domain names, and a receiving host can check such authorization".
  • The document also limits the cost of checking. The terms include, a, mx, ptr, exists and redirect cause DNS queries, and implementations "MUST limit the total number of those terms to 10 during SPF evaluation, to avoid unreasonable load on the DNS".
  • Exceeding the limit is not a temporary failure. The implementation "MUST return permerror", which means "the domain's published records could not be correctly interpreted" and "definitely requires DNS operator intervention".

An authorization language that runs in the receiver's resolver

SPF is unusual among policy languages in that the publisher does not evaluate it. The domain publishes a DNS record, and every receiver that wants a verdict must fetch and interpret that record using its own resolver, on its own budget.

That shape makes the cost of a policy a public question. A record that references five other domains, each of which references two more, is cheap to write and expensive to check, and the expense lands on the party doing the checking.

The budget of ten

The fix is a ration. Terms that trigger queries are counted, and after ten the evaluation stops with an error. The document is explicit about the motive: "to avoid unreasonable load on the DNS", which is to say on everybody's resolver.

The count is also a limit on expressiveness. A policy can delegate to other domains through include, and include chains are exactly what consumes the allowance, which is why mail systems that mash several sending platforms into one record run out of it.

What it means to fail this way

The failure mode is deliberate and slightly harsh. Running out of lookups does not produce a temporary error that a sender can retry; it produces permerror, which is the vocabulary's way of saying the published record is malformed.

The verdict then applies to the message, not the record: the receiver decides what to do with mail from a domain whose policy cannot be read, and "the domain publishes something broken" is a bad position to be in when the decision is made by strangers.

The sub-limit inside mx

The document adds a second cap for the mechanism most likely to explode. Each mx term must not cause more than ten address queries either, and exceeding that also produces a permanent error.

Two caps, one intent: keep the worst case of evaluating somebody else's policy small enough that a resolver can serve many policies a second.

Policy with a price list attached

Most standards say what must happen; this one also says how much work the answer may require. That is a useful habit for any system where the policy is published by one party and executed by another.

The cost is that the price list becomes part of the language. A domain can be perfectly clear about who may send its mail and still fail, because clarity was expressed in more lookups than the budget allows.