feat(sources): add Sable DNS source #9
No reviewers
Labels
No labels
bug
docs
duplicate
enhancement
help wanted
invalid
nice-to-have
pre-1.0
question
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/lamplighter!9
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/2-sable"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #2
Adds a Sable DNS source (
sable) with both roles,:problemsand:context. It reads Sable's publicGET /api/v1/healthand calls Sable's MCP server (POST /mcp, one JSON-RPCtools/callper request,Authorization: Bearer,MCP-Protocol-Version: 2025-06-18). Only read-only tools that Sable turns on by default are used. Written against Sable's source atbc7adf2(Oct 30):internal/web/server.go,mcp.go,mcp_advanced_tools.go,mcp_server_tools.go.Why MCP and not just the REST API: block-list health, per-node cluster problems, and Insights findings are only exposed through the MCP tools.
/api/v1/policyhas counts but no health.What it reports
server:availability: the health endpoint'sstatus, with version, config revision, and query-log drop/write-error counts as factsblock_list:<name>:incident(list_block_lists,blocking.read): failing/warning when the last update failed. Why is Sable's own detail, e.g.download …: HTTP 503 (last successful update …)cluster_node:<name>:availability(get_cluster_status,cluster.read): serious if notonline(why: last contact), warning if it has open problems (why: Sable's problem text), pending whilelag > 0. Not clustered: no cluster signalscluster:rollout:incident: serious when a rolling update has anerror, naming the failed nodefinding:<id>:insight(list_findingsover the last day,logs.read): findings with toneattention, orattention+noticeif chosen. Finding IDs are Sable's stablekind:subjectids. Block-list findings are left out because the block-list signals already cover themA tool that comes back as a tool error (token lacks the grant, or turned off in Sable) is skipped: its signals are left out, it's logged at info, and the connection test names it. A 404 from
/mcpfails the poll with "turn it on in Integrations → MCP Server", and 401/403/redirect/JSON-RPC errors/transport errors each get their own message.Settings
URL (a pasted
/dns-querysuffix is dropped), API token (secret), the usual TLS trust fields, and Insights findings to report (needs attention / attention and notices / none). Polls every 2 minutes by default. The setup guide lists the grants:blocking.read, cluster.read, logs.read, zones.read, metrics.read.Context queries
lookup(resolve a name through Sable and say where the answer came from),check_domain(blocked? which rule and list),stats(get_statsfor a range, top 10 blocked), andfindings(every finding for a range, capped at 50).context_summary: e.g.Sable 1.1.0, 2 block lists, 3 nodes, 2 online, 1 behind, 1 with problems. list_findings skipped: Insights is turned off.Logging
Failed tool calls log
Sable: MCP tool <name> on <url> failed after N ms: <reason>, a failed poll logs the URL and duration, skipped tools log at info, and successful polls log the duration and the skipped tools at debug.Screenshots
Settings form with example values, desktop and 390px:
(The 390px header overflow is the same one on
main, passed to the gap audit.)Testing
test/lamplighter/sources/sable_test.exs: 21 tests withReq.Teststubs and fixtures shaped after Sable's handlers (a healthy and a failing block list; a 3-node cluster with one offline, one behind with a problem; attention, notice, positive, and block-list findings). Covers skipped tools, MCP off (404), 401, a JSON-RPC error, a transport error, the request headers and arguments, and every context querymix precommit: 627 tests pass, no warningsNot yet run against a live Sable; the shapes come from its source, not a running instance.
11a237be162caabbb4d0Re-review of #9 at
2caabbb(Nye)F5 fixed. An "unknown tool" JSON-RPC error (-32602, matching Sable's internal/web/mcp.go:167 "unknown tool: ") is now kept as {:skipped, ...} like a missing grant, so a Sable 1.5.x still reports block lists and findings and the poll doesn't fail. The "needs Sable 1.6 or newer" note for get_cluster_status is right: list_block_lists/list_findings are in v1.5.0, get_cluster_status first ships in v1.6.0. metrics.read is now in the token help.
Non-blocking: other -32602 errors (bad arguments) still surface as refusals, which is correct; for query tools on an old Sable the user gets "Sable: this Sable has no X; it needs Sable a newer version" — the wording "needs Sable a newer version" reads a little oddly; consider "needs a newer Sable". Ready to ship from my side.