Files
urutau/internal/core/review_test.go
T
Lucas RayanandClaude Opus 5.5 2ebda1e4d7
Release / Plan (reuse the published image?) (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 20s
CI / Tests (Linux, race detector) (push) Successful in 1m10s
Release / ci (push) Successful in 1m10s
Release / Build image (arm64) (push) Successful in 55s
Release / Build image (amd64) (push) Successful in 1m16s
Release / Publish tags (push) Successful in 14s
Release / Gitea release (push) Skipped
feat: 1.3.0 thirteen new pages, charts, tooltips and error analysis
New pages grouped in the rail (Monitor, Investigate, Analyze, Operate,
Reports): Services (SLO, Apdex, latency app vs proxy), Sessions (stage
funnel), Campaigns, Event search, MITRE ATT&CK matrix, Evolution,
Concentration (Pareto, Gini), Survival (Kaplan-Meier per attack
episode, recidivists), Where errors come from (application vs failed
attack vs proxy vs client), Protocols and TLS, Defense (fail2ban, SSH,
blocklist), Integrity, and a printable executive report.

Chart library (donut, radar, stacked area, bars, heatmap, gauge),
glossary with accessible "?" tooltips, self-explanatory category names
(nonexistent page 404), page loader through pages.json.

Unique visitors fixed: real browsers opening a page, one per IP per day,
deduplicated across domains, with non-human clients counted apart.
Anonymous legitimate visits on the Live page (?visits=1, no IP).
Traefik origin, service, protocol and TLS fields parsed. Paths and
Referer paths drop e-mail and token segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 22:39:33 -03:00

54 lines
2.0 KiB
Go

package core
import "testing"
func TestGitFilesAreScanner(t *testing.T) {
for _, p := range []string{"/.git-credentials", "/.gitignore", "/.gitconfig", "/.git-rewrite", "/.git/HEAD"} {
if c := Classify("GET", p, 404); c.Cat != Scanner {
t.Errorf("%s: %s", p, c.Cat)
}
}
if c := Classify("GET", "/.github/workflows/x.yml", 404); c.Cat == Scanner {
t.Errorf(".github: %s", c.Cat)
}
}
func TestTraefikSecFetchFraming(t *testing.T) {
base := `{"ClientHost":"8.8.8.8","RequestHost":"a.example","RequestMethod":"GET","RequestPath":"/etc/passwd","DownstreamStatus":404,"StartUTC":"2026-11-14T10:00:00Z"`
for _, tc := range []struct {
extra string
want bool
}{
{``, false},
{`,"request_Sec-Fetch-Site":"cross-site","request_Sec-Fetch-Dest":"image","request_Referer":"https://evil.example/"`, true},
{`,"request_Sec-Fetch-Site":"same-site"`, true},
{`,"request_Sec-Fetch-Site":"none","request_Sec-Fetch-Dest":"document"`, false},
{`,"request_Sec-Fetch-Site":"same-origin","request_Sec-Fetch-Dest":"Script"`, true},
} {
ev, err := ParseTraefik([]byte(base + tc.extra + `}`))
if err != nil || ev.Framed != tc.want || ev.Cat != Exploit {
t.Errorf("%s: framed=%v cat=%s err=%v", tc.extra, ev.Framed, ev.Cat, err)
}
}
}
func TestTraefikFetchDestAndPrefetch(t *testing.T) {
base := `{"ClientHost":"8.8.8.8","RequestHost":"a.example","RequestMethod":"GET","RequestPath":"/","DownstreamStatus":200,"StartUTC":"2026-11-14T10:00:00Z"`
for _, tc := range []struct {
extra string
dest string
prefetch bool
}{
{``, "", false},
{`,"request_Sec-Fetch-Dest":"Document"`, "document", false},
{`,"request_Sec-Fetch-Dest":"empty"`, "empty", false},
{`,"request_Sec-Purpose":"prefetch;prerender"`, "", true},
{`,"request_Purpose":"prefetch"`, "", true},
} {
ev, err := ParseTraefik([]byte(base + tc.extra + `}`))
if err != nil || ev.FetchDest != tc.dest || ev.Prefetch != tc.prefetch {
t.Errorf("%s: dest=%q prefetch=%v err=%v", tc.extra, ev.FetchDest, ev.Prefetch, err)
}
}
}