Files
urutau/internal/rdns/ttl_test.go
T
Lucas RayanandClaude Opus 5.5 b7462c14fa
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 27s
CI / Dependency audit (push) Successful in 18s
CI / Tests (Linux, race detector) (push) Successful in 58s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Successful in 5s
feat: 1.2.0 attack intelligence, replay, 30-day history and new interface
Intelligence: attack families mapped to MITRE ATT&CK, network type from
ASN/rDNS without external APIs, request cadence, sessions with
recon/probe/exploit/access/banned stages, campaigns across IPs, verdict
with reasons, recommended actions, exposure detection (2xx with a body
on sensitive paths), STIX 2.1 export, FCrDNS for search engine bots,
optional Tor exit list.

Data: 30-day retention, twelve ranges plus custom from/to, an on-disk
event log (daily files, hourly gzip members, size cap, corruption and
disk-full tolerant), /events, /period, /metrics with stable per-hour
metrics, an extended /ip/{ip}, and peer /period merged on the hub.

Interface: layout system with fixed card sizes, range picker in the
URL, IP analysis page, Replay page, Geography down to state and city
(Natural Earth admin-1), Live page redesigned with stable metrics and a
reusable attack map. Demo data and documentation screenshots.

Security: bounded and deadline-limited period computations, linear
campaign clustering, singleflight caches, sanitized peer studies, event
query budgets, gzip bomb guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 21:45:59 -03:00

37 lines
955 B
Go

package rdns
import (
"context"
"errors"
"net"
"testing"
"time"
)
func TestFCrDNSTransientFailureIsNotCachedForADay(t *testing.T) {
r := New()
r.lookup = func(context.Context, string) ([]string, error) { return nil, errors.New("i/o timeout") }
if r.FCrDNS("66.249.66.1", []string{"googlebot.com"}) {
t.Fatal("a timeout is not a confirmation")
}
var exp time.Time
for _, e := range r.fcr {
exp = e.exp
}
if time.Until(exp) > 2*time.Minute {
t.Fatalf("a transient failure must be retried soon, expires in %v", time.Until(exp))
}
// the name really does not exist: that answer is final
r2 := New()
r2.lookup = func(context.Context, string) ([]string, error) {
return nil, &net.DNSError{Err: "no such host", IsNotFound: true}
}
r2.FCrDNS("66.249.66.2", []string{"googlebot.com"})
for _, e := range r2.fcr {
exp = e.exp
}
if time.Until(exp) < 23*time.Hour {
t.Fatalf("NXDOMAIN keeps the long TTL: %v", time.Until(exp))
}
}