[ SPF ]

SPF flattening: compare lookup relief with maintenance risk

Flattening can reduce DNS-dependent SPF evaluation, but it transfers responsibility for address changes to a refresh process. Compare both sides before choosing it.

By the EmailAuth research team · 4 min read

[ Key points ]

  • Establish the evaluated-path constraint before converting.
  • Preserve policy meaning rather than scraping address strings.
  • Require refresh ownership, monitoring and a recovery path.
On this page

SPF flattening is a way of replacing some DNS-dependent authorisation with explicit address ranges. It can make an evaluation less dependent on nested lookups. It can also leave you maintaining a copy of someone else's changing network. A useful decision therefore compares the proposed record and the process that will keep it correct.

Establish the actual constraint

Start with the exact envelope domain used by the affected application, not simply the company's website domain. Collect the present record, its dependencies and representative sending addresses. Run a standards-aware evaluation with those inputs and retain the trace. A label saying “too many lookups” is not enough to decide what to replace.

RFC 7208 section 4.6.4 limits evaluated DNS-dependent terms globally across recursion. Explicit ip4 and ip6 mechanisms are outside that term budget. This is the potential lookup benefit; it is not a promise that every flattened record is small, correct or fast.

First remove authorisations whose business owners confirm they are obsolete. Check whether a distinct application can use an appropriately configured envelope subdomain. Neither cleanup nor segmentation should be performed blindly: list the affected messages and confirm the provider supports the proposed identity. Use the sender inventory to connect a record entry to a real service.

Compare meaning, not just address lists

Under RFC 7208 §5.2, an include is an evaluation of another policy, not a text file of networks to copy. Qualifiers, order, nested includes, redirect and macros can affect its result. A converter needs to preserve the intended authorisation for the supported inputs or explicitly declare what it cannot represent. Reject a conversion that simply collects every IP-looking value from a tree.

For each proposed replacement, ask which upstream policy it represents, which inputs were tested, whether IPv6 is covered, and how changes are detected. Keep the original dependency and provider documentation beside the generated output. Avoid broadening adjacent networks into a larger range merely to shorten the text unless that entire range is independently authorised.

Make the maintenance cost visible

This is an illustrative decision, not a tested deployment. A billing sender references a provider policy that currently authorises two ranges. A flattened copy contains those ranges. Tomorrow the provider adds a third. The original dependency can expose the new authorisation through DNS; the copy will not contain it until a successful refresh publishes an update. The reverse problem occurs when the provider withdraws a range but the copy retains it.

Assign someone to own freshness, failed refreshes, unexpected large changes and emergency restoration. Ask for an alert when the generation process stops, rather than only when the published record is syntactically valid. A valid stale record can still be the wrong record.

Test a candidate before replacement

Preserve the previous record and produce an explicit before-and-after diff. Test known senders, an unauthorised address, each relevant IP family and the final nonmatching result. Inspect the actual TXT response, including its size and string boundaries. RFC 7208 §3.3 and RFC 7208 §3.4 explain why splitting a TXT value into character strings does not remove the need to manage the overall DNS response.

Use a controlled sending test after approved publication. Record the receiving system's authentication result and the envelope identity it evaluated. Do not equate an SPF improvement with DMARC alignment or guaranteed inbox placement.

Choose an operating model you can sustain

Keep the dependency-based policy when its evaluation is acceptable and its ongoing ownership is clearer. Consider flattening only with demonstrated semantic coverage, a dependable refresh mechanism, alerting and an exit plan. A smaller lookup count is useful evidence, but not the whole acceptance decision. For maintenance after adoption, continue with stale flattened SPF.

Record the next decision

For a hypothetical conversion, list supported upstream constructs, source snapshot time, tested identities/IPs, expected terminal results and who detects added or withdrawn ranges. If a macro-dependent authorization cannot be represented for the intended inputs, the candidate is not ready merely because its lookup count is smaller. No conversion, DNS change or sending test was executed for this article.

[ Takeaway ]

Establish the evaluated-path constraint before converting. Preserve policy meaning rather than scraping address strings. Require refresh ownership, monitoring and a recovery path.

[ By role ]

What this means for you

Choose your role for practical next steps.

IT / Mail Admin

Preserve the policy meaning.

Evaluate the candidate against actual sending identities and supported upstream constructs.

Next steps

  1. Keep the dependency tree and versioned output.
  2. Test both IP families where used.
  3. Alert on failed refreshes and unexplained range expansion.

CISO / SecOps

Review delegated authorisation.

A copied network list becomes part of the organisation’s trust boundary.

Next steps

  1. Check that ranges are not broadened.
  2. Require evidence for withdrawn-address removal.
  3. Review access to the generation and publishing process.

Founder / Non-technical

Price the ongoing work.

Treat refresh monitoring as an operating responsibility, not a one-time DNS repair.

Next steps

  1. Identify the critical messages at risk.
  2. Fund an owner for freshness alerts.
  3. Require an exit plan before purchase.

[ FAQs ]

Frequently asked questions

Does flattening eliminate all DNS use?

No. Receivers still need to obtain the published SPF policy. Flattening changes selected mechanisms and dependencies, rather than removing DNS from SPF.

RFC 7208 §4.4

Is flattening required whenever a tool shows ten lookups?

No. Establish what the tool counted and which path was evaluated. Ten is the permitted evaluated-term ceiling, not an automatic instruction to replace every include.

RFC 7208 §4.6.4

Can I copy every provider IP into my record?

Only use a representation that preserves the authorised scope for your service and inputs. Blind collection can overlook policy semantics or include addresses that should not be authorised.

RFC 7208 §5.2 RFC 7208 §7

What happens when the provider adds a range?

A static copy needs a successful update before it reflects that range. Decide who detects, validates and publishes the change.

Can an automated service solve the maintenance problem?

It can take on parts of the work, but verify its refresh coverage, error handling, monitoring and recovery rather than assuming the service label proves them.

Should I combine ranges to shorten the record?

Not unless the full combined network is authorised. A shorter CIDR expression can unintentionally grant more sending authority.

RFC 7208 §5.6

Will flattening fix DMARC alignment?

Not by itself. Alignment relates the authenticated identity to the visible From domain; replacing SPF mechanisms does not automatically change those identities.

RFC 9989 §4.4

What evidence supports a go decision?

Keep a semantic comparison, representative positive and negative tests, the refresh owner, alert conditions and a tested restoration procedure.

[ Sources ]

Sources

  1. RFC 7208

    Sections §2.4 · §3.3 · §3.4 · §4.4 · §4.6.4 · §5.2 · §5.6 · §6.1 · §7

  2. RFC 9989

    Sections §4.4

[ Glossary ]

Glossary

SPF
Authorization evaluation for a connecting IP and the relevant SMTP identity.

RFC 7208 §2.4

SPF include
Recursive evaluation whose pass makes the include match; its qualifier determines the outer result.

RFC 7208 §5.2

Enterprise provenance

Why top financial institutions and governments retired their email security dashboards.

Traditional email authentication platforms sell you a dashboard and ask your engineers to do the labour. In high-stakes environments, manual oversight means delayed enforcement, configuration drift and unmonitored shadow domains.

EmailAuth is the agentic email provenance platform. Our agents enforce p=reject, keep third-party senders aligned and move your domains to full RFC 9989 compliance, the new DMARC standard,, with human-in-the-loop auditability.

Governments Large enterprises Tier-1 financial institutions

SaaS · Dedicated tenancy · Air-gapped on-prem · BYOK encryption

Knowledge Base