# OpsLint — RFC 7208 SPF Lookup & Triple-Counter Workbench

Canonical URL: https://opslint.dev/spf/

## Capabilities

- **3-Tier DoH Recursive Resolution**: Queries `cloudflare-dns.com/dns-query` -> `dns.google/resolve` -> same-origin `/api/doh-fallback` (when corporate Secure Web Gateways block public DoH).
- **Strict Numeric RR Type Filtering & RFC 1035 Multi-String Concatenation**: Filters `Answer` records strictly by DNS numeric type (`TXT=16`, `MX=15`, `A=1`, `AAAA=28`, `CNAME=5`) so CNAME hops are never misparsed as TXT records, and concatenates `>255`-byte multi-segment TXT strings seamlessly (`RFC 7208 §3.3`).
- **RFC 7208 Triple-Counter State Machine**:
  1. Global DNS-querying mechanisms & modifiers (`include`, `a`, `mx`, `ptr`, `exists`, `redirect=`) `<= 10` (`RFC 7208 §4.6.4`). Root TXT, `ip4`, `ip6`, `all`, and `exp=` are exempt.
  2. Per-`mx` and per-`ptr` address (`A`/`AAAA`) lookups `<= 10` (`RFC 7208 §4.6.4`).
  3. Global void lookups (`NXDOMAIN` Status=3 or `NOERROR` RCODE=0 with 0 matching answers) `<= 2` (`RFC 7208 §4.6.4`).
- **Macro Safety (`RFC 7208 §7`)**: Never sends unexpanded `%{i}`, `%{ir}`, `%{s}`, `%{h}`, or `%{p}` macros to DoH (preventing fake `NXDOMAIN` void lookups). Reserves `+1` lookup slot and expands `%{i}` / `%{ir}` / `%{v}` / `%{d}` / `%{s}` when a simulated sender IP/email is supplied.
- **Cycle Detection & Circuit Breaker**: Detects circular `include:`/`redirect=` chains (`PermError: Loop detected`) and enforces a hard `30`-query DoH cap per run.

## Deep-Link `#hash` Parameters (Zero Server Leakage)

- `https://opslint.dev/spf/#domain=example.com`
- `https://opslint.dev/spf/#domain=example.com&ip=198.51.100.44&sender=ops%40example.com`

## Remote MCP Tool (`lint_spf_record`)

Endpoint: `https://opslint.dev/mcp`

```json
{
  "tool": "lint_spf_record",
  "arguments": {
    "domain": "example.com",
    "simulatedIp": "198.51.100.44"
  }
}
```
