Skip to content

Import dropdown: pull a zone live from a public resolver#11

Merged
fsjobeck merged 1 commit intomainfrom
feat/import-from-dns
May 1, 2026
Merged

Import dropdown: pull a zone live from a public resolver#11
fsjobeck merged 1 commit intomainfrom
feat/import-from-dns

Conversation

@fsjobeck
Copy link
Copy Markdown
Member

@fsjobeck fsjobeck commented May 1, 2026

Summary

The "Import…" button is now a dropdown:

  • From file… — current file picker
  • From public DNS — one entry per configured DoH resolver (Cloudflare, Google, DNS.SB)

Picking a resolver opens a small inline form for a domain. On submit we fan out DoH queries to that single resolver for:

  • Apex RR types: SOA, NS, A, AAAA, MX, TXT, CAA
  • Well-known subdomain probes: www, _dmarc, mail, autodiscover

…and assemble a `Zone` from the answers. SOA TTL becomes the zone-level `$TTL`; per-record TTLs come straight from the resolver.

Why

  • Faster than copy-pasting from a registrar UI
  • Matches the existing propagation-check infrastructure (same resolvers, same allowlist)
  • Honest: per-type errors are surfaced through the existing parseErrors panel, so partial imports stay usable

What's new

File What
`src/dns/import.ts` Pure fan-out logic; converts DoH answers to ZoneRecords
`src/components/ImportMenu.tsx` Replaces the bare Import button — dropdown + inline domain form
`src/hooks/useZoneFile.ts` New `importFromDns()` + `isResolving`
`src/components/Topbar.tsx` Wires the new menu in; old refs/file-input markup removed
`src/styles.css` Dropdown + inline-form styles
`tests/dns-import.test.ts` 9 new tests (apex fan-out, MX/TXT/SOA shape, domain normalization, error paths)

Test plan

  • CI passes (build + audit + 116 vitest)
  • In dev: click Import → menu shows; pick Cloudflare → enter `codabind.com` → records populate
  • Bad domain (e.g. `asdf`) yields a parseErrors entry, not a crash
  • Esc / outside-click closes the dropdown
  • Import button shows "Resolving…" while in flight

Notes

  • We can't enumerate all subdomains via public DoH (that would require AXFR), so subdomain probes are a curated list. Users can edit / add records normally after the import.
  • No CSP changes — the resolver hosts are already in `connect-src`.

🤖 Generated with Claude Code

The Topbar's "Import…" button is now a dropdown that offers the
existing file-pick path plus three "From public DNS" entries —
one per configured DoH resolver (Cloudflare, Google, DNS.SB).

Picking a resolver opens an inline form for the domain. On submit
we fan out DoH queries for the apex RR types (SOA, NS, A, AAAA,
MX, TXT, CAA) plus a small set of well-known subdomain probes
(www, _dmarc, mail, autodiscover) and assemble a Zone from the
answers. SOA TTL becomes the zone $TTL; per-record TTLs come
straight from the resolver's response.

Per-type errors are collected and surfaced through the existing
parseErrors panel so a partial import is still usable. The import
button shows "Resolving…" and disables while a fan-out is in
flight.

New module \`src/dns/import.ts\` is the pure logic; \`useZoneFile\`
gains \`importFromDns(resolverId, domain)\` and an \`isResolving\`
flag. New component \`ImportMenu\` owns the dropdown + the inline
domain form and replaces the inline file-input button in Topbar.
9 new tests cover the apex fan-out, MX/TXT/SOA shape, domain
normalization, unknown resolver, empty domain, and network failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fsjobeck fsjobeck merged commit e2dc7cd into main May 1, 2026
2 checks passed
crhaglun pushed a commit that referenced this pull request May 8, 2026
The Topbar's "Import…" button is now a dropdown that offers the
existing file-pick path plus three "From public DNS" entries —
one per configured DoH resolver (Cloudflare, Google, DNS.SB).

Picking a resolver opens an inline form for the domain. On submit
we fan out DoH queries for the apex RR types (SOA, NS, A, AAAA,
MX, TXT, CAA) plus a small set of well-known subdomain probes
(www, _dmarc, mail, autodiscover) and assemble a Zone from the
answers. SOA TTL becomes the zone $TTL; per-record TTLs come
straight from the resolver's response.

Per-type errors are collected and surfaced through the existing
parseErrors panel so a partial import is still usable. The import
button shows "Resolving…" and disables while a fan-out is in
flight.

New module \`src/dns/import.ts\` is the pure logic; \`useZoneFile\`
gains \`importFromDns(resolverId, domain)\` and an \`isResolving\`
flag. New component \`ImportMenu\` owns the dropdown + the inline
domain form and replaces the inline file-input button in Topbar.
9 new tests cover the apex fan-out, MX/TXT/SOA shape, domain
normalization, unknown resolver, empty domain, and network failure.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant