Files
urutau/internal/core/review_test.go
T
Lucas RayanandClaude Opus 5.5 b4a2c2c9ec
Release / Plan (reuse the published image?) (push) Successful in 4s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 1m29s
CI / Tests (Linux, race detector) (push) Failing after 1m48s
CI / Dependency audit (push) Successful in 21s
Release / ci (push) Failing after 1m50s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
feat: Urutau 1.0.0, lightweight threat intelligence and web analytics
Always-on Go service (stdlib only) that follows the Traefik JSON access
log, the sshd log and the fail2ban log of a host, classifies attacks,
scores sources, keeps bounded aggregates with snapshots, and serves an
embedded dashboard with live updates, offline geolocation (DB-IP Lite),
privacy-friendly traffic analytics, an exportable blocklist and
token-authenticated federation between instances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 16:13:34 -03:00

34 lines
1.2 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)
}
}
}