perf(replay): threats-only by default, no duplicate first-page or summary fetch
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
19bec553f4
commit
91cdb4acbf
12 files changed
+111
-23
No files matched your search
@@ -115,7 +115,26 @@ func TestEventsAPI(t *testing.T) {
|
||||
if m = getJSON(t, h, "/api/v1/events?q=SQLMAP&host=oracle", auth); len(m["events"].([]any)) != 6 {
|
||||
t.Fatalf("q filter: %v", len(m["events"].([]any)))
|
||||
}
|
||||
for _, bad := range []string{"limit=0", "limit=x", "order=up", "cat=nope", "ip=zzz", "cursor=!!", "host=" + strings.Repeat("a", 100)} {
|
||||
// "!" excludes: "!ok" keeps every category but ok, and nothing else is dropped
|
||||
all := getJSON(t, h, "/api/v1/events?limit=100", auth)["events"].([]any)
|
||||
nOK, kept := 0, getJSON(t, h, "/api/v1/events?limit=100&cat=!ok", auth)["events"].([]any)
|
||||
for _, e := range all {
|
||||
if e.(map[string]any)["cat"] == "ok" {
|
||||
nOK++
|
||||
}
|
||||
}
|
||||
for _, e := range kept {
|
||||
if e.(map[string]any)["cat"] == "ok" {
|
||||
t.Fatal("cat=!ok returned an ok event")
|
||||
}
|
||||
}
|
||||
if len(kept) != len(all)-nOK {
|
||||
t.Fatalf("cat=!ok kept %d of %d (%d ok)", len(kept), len(all), nOK)
|
||||
}
|
||||
if n := len(getJSON(t, h, "/api/v1/events?limit=100&cat=!scanner,exploit", auth)["events"].([]any)); n == 0 || n >= len(all) {
|
||||
t.Fatalf("cat=!scanner,exploit: %d of %d", n, len(all))
|
||||
}
|
||||
for _, bad := range []string{"limit=0", "limit=x", "order=up", "cat=nope", "cat=!nope", "cat=!ok,", "cat=!" + strings.Repeat("ok,", 40), "ip=zzz", "cursor=!!", "host=" + strings.Repeat("a", 100)} {
|
||||
if w := do(h, "GET", "/api/v1/events?"+bad, cloneHdr(auth), nil); w.Code != 400 {
|
||||
t.Errorf("%s: %d", bad, w.Code)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user