From eb1c75d264eab0ff925987dda38f0bdb0f22659a Mon Sep 17 00:00:00 2001 From: clawbot Date: Thu, 19 Nov 2026 22:14:03 +0000 Subject: [PATCH] waf: a ban's notes take the host from site, not a second field decision held the visitor's Host twice: as site, set by answerQuestion for the alerts, and as host, added for a ban's notes. Bans are made only from questions, where the two are always equal. noted now reads site, and host is gone. Model: opus-5-5 --- internal/waf/bans.go | 2 +- internal/waf/request.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/waf/bans.go b/internal/waf/bans.go index a81bd2b..b327cf4 100644 --- a/internal/waf/bans.go +++ b/internal/waf/bans.go @@ -333,7 +333,7 @@ func (rq *request) noted(now time.Time, status int) bans.Request { return bans.Request{ Time: now, Method: rq.method, - Host: rq.host, + Host: rq.site, Path: rq.requestURI, Status: status, UserAgent: rq.userAgent, diff --git a/internal/waf/request.go b/internal/waf/request.go index d9a8d95..56e6a03 100644 --- a/internal/waf/request.go +++ b/internal/waf/request.go @@ -32,16 +32,17 @@ type refusal struct { type decision struct { line requestlog.Line client netip.Addr - // method, host and userAgent are the request's method, Host and - // User-Agent, and requestURI its path with the query, as a ban's notes - // keep them. startRequest sets them. - method, host, userAgent, requestURI string + // method and userAgent are the request's method and User-Agent, and + // requestURI its path with the query, as a ban's notes keep them. + // startRequest sets them. + method, userAgent, requestURI string // tags are the request's tags, sorted, each once. addTag adds them, for // tagLists, routeWatchTags, noteLookup, dnsbl, abuseIPDB, ruleFiles and // coreRuleSet. tags []string // site is, for a question, the host the visitor asked for, which the - // alerts name, since one waf serves many sites. + // alerts and a ban's notes name, since one waf serves many sites. + // answerQuestion sets it. site string // allowed is true for a question answered with DispositionAllow. allowed bool @@ -122,7 +123,6 @@ func (h *handler) startRequest( decision: decision{ client: client, method: r.Method, - host: r.Host, userAgent: r.UserAgent(), requestURI: r.URL.RequestURI(), line: requestlog.Line{