From 3c42963c85b94cd9251c95bc89710d12d48b3003 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Fri, 1 Aug 2025 22:19:32 +0000 Subject: [PATCH] chore(lib/policy): start the deprecation process for slow This mostly adds a warning, but the "slow" method is in the process of being removed. Warn admins with slog.Warn. Signed-off-by: Xe Iaso --- lib/policy/policy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/policy/policy.go b/lib/policy/policy.go index 3dc3157..5493d8d 100644 --- a/lib/policy/policy.go +++ b/lib/policy/policy.go @@ -149,6 +149,10 @@ func ParseConfig(ctx context.Context, fin io.Reader, fname string, defaultDiffic if parsedBot.Challenge.Algorithm == "" { parsedBot.Challenge.Algorithm = config.DefaultAlgorithm } + + if parsedBot.Challenge.Algorithm == "slow" { + slog.Warn("use of deprecated algorithm \"slow\" detected, please update this to \"fast\" when possible", "name", parsedBot.Name) + } } if b.Weight != nil { @@ -163,6 +167,10 @@ func ParseConfig(ctx context.Context, fin io.Reader, fname string, defaultDiffic } for _, t := range c.Thresholds { + if t.Challenge != nil && t.Challenge.Algorithm == "slow" { + slog.Warn("use of deprecated algorithm \"slow\" detected, please update this to \"fast\" when possible", "name", t.Name) + } + if t.Name == "legacy-anubis-behaviour" && t.Expression.String() == "true" { if !warnedAboutThresholds.Load() { slog.Warn("configuration file does not contain thresholds, see docs for details on how to upgrade", "fname", fname, "docs_url", "https://anubis.techaro.lol/docs/admin/configuration/thresholds/")