jane remover
Some checks failed
Docker image builds / build (push) Waiting to run
Asset Build Verification / asset_verification (push) Has been cancelled
Docs deploy / build (push) Has been cancelled
Go Mod Tidy Check / go_mod_tidy_check (push) Has been cancelled
Go / go_tests (push) Has been cancelled
Package builds (unstable) / package_builds (push) Has been cancelled
Smoke tests / smoke-test (default-config-macro) (push) Has been cancelled
Smoke tests / smoke-test (docker-registry) (push) Has been cancelled
Smoke tests / smoke-test (double_slash) (push) Has been cancelled
Smoke tests / smoke-test (forced-language) (push) Has been cancelled
Smoke tests / smoke-test (git-clone) (push) Has been cancelled
Smoke tests / smoke-test (git-push) (push) Has been cancelled
Smoke tests / smoke-test (healthcheck) (push) Has been cancelled
Smoke tests / smoke-test (i18n) (push) Has been cancelled
Smoke tests / smoke-test (log-file) (push) Has been cancelled
Smoke tests / smoke-test (nginx) (push) Has been cancelled
Smoke tests / smoke-test (palemoon/amd64) (push) Has been cancelled
Smoke tests / smoke-test (robots_txt) (push) Has been cancelled
Check Spelling / Check Spelling (push) Has been cancelled
SSH CI / ssh (aarch64-16k) (push) Has been cancelled
SSH CI / ssh (aarch64-4k) (push) Has been cancelled
SSH CI / ssh (ppc64le) (push) Has been cancelled
SSH CI / ssh (riscv64) (push) Has been cancelled
zizmor / zizmor latest via PyPI (push) Has been cancelled

This commit is contained in:
Soph :3 2026-02-07 13:08:47 +02:00
parent d2205b11a7
commit 896858e027
332 changed files with 1482 additions and 33742 deletions

View file

@ -4,9 +4,9 @@ import (
"log/slog"
"time"
"github.com/TecharoHQ/anubis/lib/store"
"git.sad.ovh/sophie/nuke/lib/store"
_ "github.com/TecharoHQ/anubis/lib/store/all"
_ "git.sad.ovh/sophie/nuke/lib/store/all"
)
type DnsCache struct {

View file

@ -8,7 +8,7 @@ import (
"testing"
"time"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/store/memory"
)
// newTestDNS is a helper function to create a new Dns object with an in-memory cache for testing.

View file

@ -47,13 +47,6 @@ var (
`request.remoteAddress in ["192.168.1.0/24", "10.0.0.0/8"]`,
`request.userAgent.matches(".*[Bb]ot.*") || request.userAgent.matches(".*[Cc]rawler.*")`,
}
// Thoth ASN checker inputs
asnInputs = []string{
"ASNChecker\nAS 15169\nAS 8075\nAS 32934",
"ASNChecker\nAS 13335\nAS 16509\nAS 14061",
"ASNChecker\nAS 36351\nAS 20940\nAS 8100",
}
)
func BenchmarkSHA256_PolicyInputs(b *testing.B) {

View file

@ -10,7 +10,7 @@ import (
"net/netip"
"strings"
"github.com/TecharoHQ/anubis"
"git.sad.ovh/sophie/nuke"
"github.com/sebest/xff"
)
@ -36,7 +36,7 @@ var CGNat = netip.MustParsePrefix("100.64.0.0/10")
// and only if the application is compiled in "release" mode by Docker.
func UnchangingCache(next http.Handler) http.Handler {
//goland:noinspection GoBoolExpressions
if anubis.Version == "devel" {
if nuke.Version == "devel" {
return next
}

View file

@ -8,7 +8,7 @@ import (
)
var Timings = promauto.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "anubis",
Namespace: "nuke",
Subsystem: "honeypot",
Name: "pagegen_timings",
Help: "The amount of time honeypot page generation takes per method",

View file

@ -10,10 +10,10 @@ import (
"net/netip"
"time"
"github.com/TecharoHQ/anubis/internal"
"github.com/TecharoHQ/anubis/internal/honeypot"
"github.com/TecharoHQ/anubis/lib/policy/checker"
"github.com/TecharoHQ/anubis/lib/store"
"git.sad.ovh/sophie/nuke/internal"
"git.sad.ovh/sophie/nuke/internal/honeypot"
"git.sad.ovh/sophie/nuke/lib/policy/checker"
"git.sad.ovh/sophie/nuke/lib/store"
"github.com/a-h/templ"
"github.com/google/uuid"
"github.com/nikandfor/spintax"

View file

@ -9,9 +9,9 @@ import (
"testing"
"time"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store"
"git.sad.ovh/sophie/nuke/lib/store/memory"
)
func TestCacheReturnsDefault(t *testing.T) {
@ -26,12 +26,12 @@ func TestCacheReturnsDefault(t *testing.T) {
Override: want,
}, memory.New(t.Context()), TargetOptions{})
u, err := url.Parse("https://anubis.techaro.lol")
u, err := url.Parse("https://nuke.sad.ovh")
if err != nil {
t.Fatal(err)
}
result, err := cache.GetOGTags(t.Context(), u, "anubis.techaro.lol")
result, err := cache.GetOGTags(t.Context(), u, "nuke.sad.ovh")
if err != nil {
t.Fatal(err)
}

View file

@ -40,7 +40,7 @@ func (c *OGTagCache) fetchHTMLDocumentWithCache(ctx context.Context, urlStr stri
// Add proxy headers
req.Header.Set("X-Forwarded-Proto", "https")
req.Header.Set("User-Agent", "Anubis-OGTag-Fetcher/1.0") // For tracking purposes
req.Header.Set("User-Agent", "Nuke-OGTag-Fetcher/1.0") // For tracking purposes
serverName := hostForRequest
if serverName == "" {

View file

@ -11,8 +11,8 @@ import (
"testing"
"time"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store/memory"
"golang.org/x/net/html"
)

View file

@ -7,8 +7,8 @@ import (
"testing"
"time"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store/memory"
)
func TestIntegrationGetOGTags(t *testing.T) {

View file

@ -6,8 +6,8 @@ import (
"strings"
"testing"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store/memory"
"golang.org/x/net/html"
)

View file

@ -11,8 +11,8 @@ import (
"sync"
"time"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store"
)
const (
@ -72,7 +72,7 @@ func NewOGTagCache(target string, conf config.OpenGraph, backend store.Interface
parsedTargetURL = &url.URL{Scheme: "http", Host: target} // Assume http if scheme missing and host-like
if !strings.Contains(target, "://") && !strings.HasPrefix(target, "unix:") {
// If it looks like just a host/host:port (and not unix), prepend http:// (todo: is this bad...? Trace path to see if i can yell at user to do it right)
parsedTargetURL, _ = url.Parse("http://" + target) // fetch cares about scheme but anubis doesn't
parsedTargetURL, _ = url.Parse("http://" + target) // fetch cares about scheme but nuke doesn't
}
}
}

View file

@ -7,8 +7,8 @@ import (
"testing"
"unicode/utf8"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store/memory"
"golang.org/x/net/html"
)

View file

@ -22,8 +22,8 @@ import (
"testing"
"time"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store/memory"
)
func TestNewOGTagCache(t *testing.T) {
@ -158,14 +158,14 @@ func TestGetTarget(t *testing.T) {
},
{
name: "Unix socket target",
target: "unix:/tmp/anubis.sock",
target: "unix:/tmp/nuke.sock",
path: "/some/path",
query: "key=value&flag=true",
expected: "http://unix/some/path?key=value&flag=true", // Scheme becomes http, host is 'unix'
},
{
name: "Unix socket target with ///",
target: "unix:///var/run/anubis.sock",
target: "unix:///var/run/nuke.sock",
path: "/",
query: "",
expected: "http://unix/",

View file

@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/memory"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store/memory"
"golang.org/x/net/html"
)

View file

@ -1,11 +1,11 @@
//go:build !windows
// Integration tests for Anubis, using Playwright.
// Integration tests for Nuke, using Playwright.
//
// These tests require an already running Anubis and Playwright server.
// These tests require an already running Nuke and Playwright server.
//
// Anubis must be configured to redirect to the server started by the test suite.
// The bind address and the Anubis server can be specified using the flags `-bind` and `-anubis` respectively.
// Nuke must be configured to redirect to the server started by the test suite.
// The bind address and the Nuke server can be specified using the flags `-bind` and `-nuke` respectively.
//
// Playwright must be started in server mode using `npx playwright@1.50.1 run-server --port 3000`.
// The version must match the minor used by the playwright-go package.
@ -28,8 +28,7 @@ import (
"testing"
"time"
"github.com/TecharoHQ/anubis"
libanubis "github.com/TecharoHQ/anubis/lib"
libnuke "git.sad.ovh/sophie/nuke/lib"
"github.com/playwright-community/playwright-go"
)
@ -88,7 +87,7 @@ var (
name: "unknownAgent",
action: actionAllow,
realIP: placeholderIP,
userAgent: "AnubisTest/0",
userAgent: "NukeTest/0",
},
}
)
@ -222,7 +221,7 @@ func TestPlaywrightBrowser(t *testing.T) {
startPlaywright(t)
pw := setupPlaywright(t)
anubisURL := spawnAnubis(t)
nukeURL := spawnNuke(t)
browsers := []playwright.BrowserType{pw.Chromium, pw.Firefox, pw.WebKit}
@ -255,7 +254,7 @@ func TestPlaywrightBrowser(t *testing.T) {
defer page.Close()
timeout := 2.0
page.Goto(anubisURL, playwright.PageGotoOptions{
page.Goto(nukeURL, playwright.PageGotoOptions{
Timeout: &timeout,
})
})
@ -271,7 +270,7 @@ func TestPlaywrightBrowser(t *testing.T) {
var performedAction action
var err error
for i := 0; i < 5; i++ {
performedAction, err = executeTestCase(t, tc, typ, anubisURL)
performedAction, err = executeTestCase(t, tc, typ, nukeURL)
if performedAction == tc.action {
break
}
@ -305,11 +304,11 @@ func TestPlaywrightWithBasePrefix(t *testing.T) {
pw := setupPlaywright(t)
basePrefix := "/myapp"
anubisURL := spawnAnubisWithOptions(t, basePrefix)
nukeURL := spawnNukeWithOptions(t, basePrefix)
// Reset BasePrefix after test
t.Cleanup(func() {
anubis.BasePrefix = ""
nuke.BasePrefix = ""
})
browsers := []playwright.BrowserType{pw.Chromium}
@ -343,7 +342,7 @@ func TestPlaywrightWithBasePrefix(t *testing.T) {
defer page.Close()
// Test accessing the base URL with prefix
_, err = page.Goto(anubisURL+basePrefix, playwright.PageGotoOptions{
_, err = page.Goto(nukeURL+basePrefix, playwright.PageGotoOptions{
Timeout: pwTimeout(testCases[0], time.Now().Add(5*time.Second)),
})
if err != nil {
@ -369,8 +368,8 @@ func TestPlaywrightWithBasePrefix(t *testing.T) {
// Complete the challenge
// Wait for the challenge to be solved
anubisTest := page.Locator("#anubis-test")
err = anubisTest.WaitFor(playwright.LocatorWaitForOptions{
nukeTest := page.Locator("#nuke-test")
err = nukeTest.WaitFor(playwright.LocatorWaitForOptions{
Timeout: pwTimeout(testCases[0], time.Now().Add(30*time.Second)),
})
if err != nil {
@ -378,7 +377,7 @@ func TestPlaywrightWithBasePrefix(t *testing.T) {
}
// Verify the challenge was solved
content, err := anubisTest.TextContent(playwright.LocatorTextContentOptions{})
content, err := nukeTest.TextContent(playwright.LocatorTextContentOptions{})
if err != nil {
pwFail(t, page, "could not get text content: %v", err)
}
@ -402,7 +401,7 @@ func TestPlaywrightWithBasePrefix(t *testing.T) {
var found bool
for _, cookie := range cookies {
if cookie.Name == anubis.CookieName {
if cookie.Name == nuke.CookieName {
found = true
if cookie.Path != basePrefix+"/" {
t.Errorf("cookie path is wrong, wanted %s, got: %s", basePrefix+"/", cookie.Path)
@ -412,7 +411,7 @@ func TestPlaywrightWithBasePrefix(t *testing.T) {
}
if !found {
t.Errorf("Cookie %q not found", anubis.CookieName)
t.Errorf("Cookie %q not found", nuke.CookieName)
}
})
}
@ -428,7 +427,7 @@ func buildBrowserConnect(name string) string {
return u.String()
}
func executeTestCase(t *testing.T, tc testCase, typ playwright.BrowserType, anubisURL string) (action, error) {
func executeTestCase(t *testing.T, tc testCase, typ playwright.BrowserType, nukeURL string) (action, error) {
deadline, _ := t.Deadline()
browser, err := typ.Connect(buildBrowserConnect(typ.Name()), playwright.BrowserTypeConnectOptions{
@ -460,7 +459,7 @@ func executeTestCase(t *testing.T, tc testCase, typ playwright.BrowserType, anub
// Attempt challenge.
start := time.Now()
_, err = page.Goto(anubisURL, playwright.PageGotoOptions{
_, err = page.Goto(nukeURL, playwright.PageGotoOptions{
Timeout: pwTimeout(tc, deadline),
})
if err != nil {
@ -480,7 +479,7 @@ func executeTestCase(t *testing.T, tc testCase, typ playwright.BrowserType, anub
// Ensure protected resource was provided.
res, err := page.Locator("#anubis-test").TextContent(playwright.LocatorTextContentOptions{
res, err := page.Locator("#nuke-test").TextContent(playwright.LocatorTextContentOptions{
Timeout: pwTimeout(tc, deadline),
})
end := time.Now()
@ -552,7 +551,7 @@ func saveScreenshot(t *testing.T, page playwright.Page) {
return
}
f, err := os.CreateTemp("", "anubis-test-fail-*.png")
f, err := os.CreateTemp("", "nuke-test-fail-*.png")
if err != nil {
t.Logf("could not create temporary file: %v", err)
return
@ -583,19 +582,19 @@ func setupPlaywright(t *testing.T) *playwright.Playwright {
return pw
}
func spawnAnubis(t *testing.T) string {
return spawnAnubisWithOptions(t, "")
func spawnNuke(t *testing.T) string {
return spawnNukeWithOptions(t, "")
}
func spawnAnubisWithOptions(t *testing.T, basePrefix string) string {
func spawnNukeWithOptions(t *testing.T, basePrefix string) string {
t.Helper()
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "text/html")
fmt.Fprintf(w, "<html><body><span id=anubis-test>%d</span></body></html>", time.Now().Unix())
fmt.Fprintf(w, "<html><body><span id=nuke-test>%d</span></body></html>", time.Now().Unix())
})
policy, err := libanubis.LoadPoliciesOrDefault(t.Context(), "", anubis.DefaultDifficulty, "info")
policy, err := libnuke.LoadPoliciesOrDefault(t.Context(), "", nuke.DefaultDifficulty, "info")
if err != nil {
t.Fatal(err)
}
@ -609,7 +608,7 @@ func spawnAnubisWithOptions(t *testing.T, basePrefix string) string {
host := "localhost"
port := strconv.Itoa(addr.Port)
s, err := libanubis.New(libanubis.Options{
s, err := libnuke.New(libnuke.Options{
Next: h,
Policy: policy,
ServeRobotsTXT: true,
@ -617,7 +616,7 @@ func spawnAnubisWithOptions(t *testing.T, basePrefix string) string {
BasePrefix: basePrefix,
})
if err != nil {
t.Fatalf("can't construct libanubis.Server: %v", err)
t.Fatalf("can't construct libnuke.Server: %v", err)
}
ts := &httptest.Server{

View file

@ -159,7 +159,7 @@ func TestComputeXFFHeader(t *testing.T) {
},
{
name: "invalid-remote-ip",
remoteAddr: "anubis:80",
remoteAddr: "nuke:80",
err: ErrCantParseRemoteIP,
},
{