feat!: Urutau 2.0.0, ultralight probes and a single analysis hub
CI / Format and vet (pull_request) Failing after 53s
CI / Dependency audit (pull_request) Successful in 33s
CI / Tests (Linux, race detector) (pull_request) Successful in 2m1s
CI / Docker images (build and smoke test) (pull_request) Failing after 47s

Each server runs an ultralight probe (scratch image, ~7 MiB RSS) that
tails the logs, ships raw lines to the hub over HTTPS with an on-disk
spool, and applies enforce decisions locally. The hub keeps one node per
probe (primary node = the 1.x data dir, unchanged), does all analysis and
serves the UI. Peer federation is removed. 'urutau import' brings 1.x
data dirs in with hash and count verification. UI: probes page, host
qualified incidents, IPs never wrap, egress heatmap labels, live and
replay globes no longer auto-rotate, replay repeat, live traffic metrics.

BREAKING CHANGE: URUTAU_PEERS, URUTAU_PEER_* and /api/v1/peer/* are gone;
log path variables move from the hub to the probe. See docs/migration-2.0.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-15 22:14:50 -03:00
1 parent 23a7a5963a
commit 8546d14cef
130 files changed
+9396 -3311

No files matched your search

+1 -25
View File
@@ -22,7 +22,7 @@ func unbanRig(t *testing.T) (http.Handler, *enforce.Engine, string) {
Host: "oracle", Threshold: 3, Share: true})
SetEnforce(e)
t.Cleanup(func() { SetEnforce(nil) })
return New(Options{Token: userTok, PeerTokens: []string{peerTok}, Version: "t", Store: st}), e, filepath.Join(dir, "unban.log")
return New(Options{Token: userTok, Version: "t", Store: st}), e, filepath.Join(dir, "unban.log")
}
func req(h http.Handler, method, path, body string, hdr map[string]string) *httptest.ResponseRecorder {
@@ -42,9 +42,6 @@ func TestUnbanRoute(t *testing.T) {
if w := req(h, "POST", "/api/v1/enforce/unban", `{"ip":"203.0.113.7","allow_s":60}`, nil); w.Code != 401 {
t.Fatalf("no auth: %d", w.Code)
}
if w := req(h, "POST", "/api/v1/enforce/unban", `{"ip":"203.0.113.7"}`, map[string]string{"Authorization": "Bearer " + peerTok}); w.Code != 403 {
t.Fatalf("peer token: %d", w.Code)
}
cross := map[string]string{"Authorization": "Bearer " + userTok, "Sec-Fetch-Site": "cross-site"}
if w := req(h, "POST", "/api/v1/enforce/unban", `{"ip":"203.0.113.7"}`, cross); w.Code != 403 {
t.Fatalf("cross-site: %d", w.Code)
@@ -96,24 +93,3 @@ func TestUnbanRoute(t *testing.T) {
t.Fatal("DELETE wrote to the host file")
}
}
func TestPeerUnbanRoute(t *testing.T) {
h, e, file := unbanRig(t)
peer := map[string]string{"Authorization": "Bearer " + peerTok}
if w := req(h, "POST", "/api/v1/peer/unban?from=hostinger", `{"unbans":[{"ip":"203.0.113.7","allow":3600},{"ip":"bad","allow":1}]}`, map[string]string{"Authorization": "Bearer " + userTok}); w.Code == 200 {
t.Fatalf("user token accepted on peer route")
}
w := req(h, "POST", "/api/v1/peer/unban?from=hostinger", `{"unbans":[{"ip":"203.0.113.7","allow":3600},{"ip":"bad","allow":1}]}`, peer)
if w.Code != 200 || !strings.Contains(w.Body.String(), `"accepted":1`) {
t.Fatalf("%d %s", w.Code, w.Body)
}
if len(e.Allows()) != 1 {
t.Fatal("peer allow not applied")
}
if b, _ := os.ReadFile(file); !strings.Contains(string(b), "ip=203.0.113.7 allow=3600") {
t.Fatalf("file: %q", b)
}
if len(e.UnbansSince(0)) != 0 {
t.Fatal("peer unban must not be echoed back")
}
}