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
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>
46 lines
1.5 KiB
Go
46 lines
1.5 KiB
Go
package app
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestRetentionEventsMaxFlags(t *testing.T) {
|
|
c, err := ParseFlags("serve", nil)
|
|
if err != nil || c.Retention != 720*time.Hour || c.EventsMax != "512MB" {
|
|
t.Fatalf("defaults %v %+v", err, c)
|
|
}
|
|
c, _ = ParseFlags("serve", []string{"--events-max", "1GiB", "--retention", "100h"})
|
|
if n, err := ParseSize(c.EventsMax); err != nil || n != 1<<30 || c.Retention != 100*time.Hour {
|
|
t.Fatal(c.EventsMax, c.Retention)
|
|
}
|
|
t.Setenv("URUTAU_EVENTS_MAX", "64m")
|
|
c, _ = ParseFlags("serve", nil)
|
|
if n, _ := ParseSize(c.EventsMax); n != 64<<20 {
|
|
t.Fatal("env")
|
|
}
|
|
tok := "tok-0123456789-abcdefghijklmnopqrstuvwxyz-QWERTY"
|
|
base := Config{Bind: "0.0.0.0:1", Ignore: DefaultIgnore, TrustedProxy: DefaultTrustedProxy, Retention: 720 * time.Hour}
|
|
if _, err := base.Validate(tok); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
base.Retention = 721 * time.Hour
|
|
if _, err := base.Validate(tok); err == nil {
|
|
t.Fatal("retention over 720h must be refused")
|
|
}
|
|
base.Retention, base.EventsMax = 720*time.Hour, "lots"
|
|
if _, err := base.Validate(tok); err == nil {
|
|
t.Fatal("bad --events-max must be refused")
|
|
}
|
|
for in, want := range map[string]int64{"512MB": 512 << 20, "0": 0, "2g": 2 << 30, "1048576": 1 << 20, "1.5kb": 1536} {
|
|
if n, err := ParseSize(in); err != nil || n != want {
|
|
t.Errorf("%s: %d %v", in, n, err)
|
|
}
|
|
}
|
|
for _, bad := range []string{"", "-1", "x", "1xb"} {
|
|
if _, err := ParseSize(bad); err == nil {
|
|
t.Errorf("%q must fail", bad)
|
|
}
|
|
}
|
|
}
|