NUKE
Some checks failed
Docker image builds / build (push) Failing after 4m22s

This commit is contained in:
Soph :3 2026-02-07 14:27:38 +02:00
parent d2205b11a7
commit 02b9aebbe5
341 changed files with 1571 additions and 32574 deletions

View file

@ -8,7 +8,7 @@ import (
"errors"
"fmt"
"github.com/TecharoHQ/anubis/lib/checker"
"git.sad.ovh/sophie/nuke/lib/checker"
)
var (

View file

@ -12,7 +12,7 @@ import (
"strings"
"time"
"github.com/TecharoHQ/anubis/data"
"git.sad.ovh/sophie/nuke/data"
"k8s.io/apimachinery/pkg/util/yaml"
)
@ -63,10 +63,6 @@ type BotConfig struct {
Challenge *ChallengeRules `json:"challenge,omitempty" yaml:"challenge,omitempty"`
Weight *Weight `json:"weight,omitempty" yaml:"weight,omitempty"`
// Thoth features
GeoIP *GeoIP `json:"geoip,omitempty"`
ASNs *ASNs `json:"asns,omitempty"`
Name string `json:"name" yaml:"name"`
Action Rule `json:"action" yaml:"action"`
RemoteAddr []string `json:"remote_addresses,omitempty" yaml:"remote_addresses,omitempty"`
@ -81,8 +77,6 @@ func (b BotConfig) Zero() bool {
b.Action != "",
len(b.RemoteAddr) != 0,
b.Challenge != nil,
b.GeoIP != nil,
b.ASNs != nil,
} {
if cond {
return false
@ -102,9 +96,7 @@ func (b *BotConfig) Valid() error {
allFieldsEmpty := b.UserAgentRegex == nil &&
b.PathRegex == nil &&
len(b.RemoteAddr) == 0 &&
len(b.HeadersRegex) == 0 &&
b.ASNs == nil &&
b.GeoIP == nil
len(b.HeadersRegex) == 0
if allFieldsEmpty && b.Expression == nil {
errs = append(errs, ErrBotMustHaveUserAgentOrPath)

View file

@ -7,8 +7,8 @@ import (
"path/filepath"
"testing"
"github.com/TecharoHQ/anubis/data"
. "github.com/TecharoHQ/anubis/lib/config"
"git.sad.ovh/sophie/nuke/data"
. "git.sad.ovh/sophie/nuke/lib/config"
)
func p[V any](v V) *V { return &v }

View file

@ -15,9 +15,9 @@ func TestImpressumValid(t *testing.T) {
{
name: "basic happy path",
inp: Impressum{
Footer: "<p>Website hosted by Techaro.<p>",
Footer: "<p>Website hosted by sad.ovh<p>",
Page: ImpressumPage{
Title: "Techaro Imprint",
Title: "sad.ovh Imprint",
Body: "<p>This is an imprint page.</p>",
},
},
@ -28,7 +28,7 @@ func TestImpressumValid(t *testing.T) {
inp: Impressum{
Footer: "",
Page: ImpressumPage{
Title: "Techaro Imprint",
Title: "sad.ovh Imprint",
Body: "<p>This is an imprint page.</p>",
},
},

View file

@ -114,7 +114,7 @@ func (lfc LoggingFileConfig) Zero() bool {
func (LoggingFileConfig) Default() *LoggingFileConfig {
return &LoggingFileConfig{
Filename: "./var/anubis.log",
Filename: "./var/nuke.log",
MaxBackups: 3,
MaxBytes: 104857600, // 100 Mi
MaxAge: 7, // 7 days

View file

@ -64,7 +64,7 @@ func TestLoggingValid(t *testing.T) {
input: &Logging{
Sink: LogSinkFile,
Parameters: &LoggingFileConfig{
Filename: "./var/anubis.log",
Filename: "./var/nuke.log",
MaxBackups: -3,
MaxBytes: 104857600, // 100 Mi
MaxAge: 7, // 7 days
@ -79,7 +79,7 @@ func TestLoggingValid(t *testing.T) {
input: &Logging{
Sink: LogSinkFile,
Parameters: &LoggingFileConfig{
Filename: "./var/anubis.log",
Filename: "./var/nuke.log",
MaxBackups: 3,
MaxBytes: 104857600, // 100 Mi
MaxAge: -7, // 7 days

View file

@ -5,8 +5,8 @@ import (
"errors"
"fmt"
"github.com/TecharoHQ/anubis/lib/store"
_ "github.com/TecharoHQ/anubis/lib/store/all"
"git.sad.ovh/sophie/nuke/lib/store"
_ "git.sad.ovh/sophie/nuke/lib/store/all"
)
var (

View file

@ -5,9 +5,9 @@ import (
"errors"
"testing"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/bbolt"
"github.com/TecharoHQ/anubis/lib/store/valkey"
"git.sad.ovh/sophie/nuke/lib/config"
"git.sad.ovh/sophie/nuke/lib/store/bbolt"
"git.sad.ovh/sophie/nuke/lib/store/valkey"
)
func TestStoreValid(t *testing.T) {
@ -53,7 +53,7 @@ func TestStoreValid(t *testing.T) {
name: "valkey backend bad URL",
input: config.Store{
Backend: "valkey",
Parameters: json.RawMessage(`{"url": "http://anubis.techaro.lol"}`),
Parameters: json.RawMessage(`{"url": "http://git.sad.ovh"}`),
},
err: valkey.ErrBadURL,
},

View file

@ -4,7 +4,7 @@ import (
"errors"
"fmt"
"github.com/TecharoHQ/anubis"
"git.sad.ovh/sophie/nuke"
)
var (
@ -16,14 +16,14 @@ var (
DefaultThresholds = []Threshold{
{
Name: "legacy-anubis-behaviour",
Name: "legacy-nuke-behaviour",
Expression: &ExpressionOrList{
Expression: "weight > 0",
},
Action: RuleChallenge,
Challenge: &ChallengeRules{
Algorithm: "fast",
Difficulty: anubis.DefaultDifficulty,
Difficulty: nuke.DefaultDifficulty,
},
},
}