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
This commit is contained in:
clawbot committed 2026-11-19 22:14:03 +00:00
1 parent 17bbea919a
commit eb1c75d264
2 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -333,7 +333,7 @@ func (rq *request) noted(now time.Time, status int) bans.Request {
return bans.Request{ return bans.Request{
Time: now, Time: now,
Method: rq.method, Method: rq.method,
Host: rq.host, Host: rq.site,
Path: rq.requestURI, Path: rq.requestURI,
Status: status, Status: status,
UserAgent: rq.userAgent, UserAgent: rq.userAgent,
+6 -6
View File
@@ -32,16 +32,17 @@ type refusal struct {
type decision struct { type decision struct {
line requestlog.Line line requestlog.Line
client netip.Addr client netip.Addr
// method, host and userAgent are the request's method, Host and // method and userAgent are the request's method and User-Agent, and
// User-Agent, and requestURI its path with the query, as a ban's notes // requestURI its path with the query, as a ban's notes keep them.
// keep them. startRequest sets them. // startRequest sets them.
method, host, userAgent, requestURI string method, userAgent, requestURI string
// tags are the request's tags, sorted, each once. addTag adds them, for // tags are the request's tags, sorted, each once. addTag adds them, for
// tagLists, routeWatchTags, noteLookup, dnsbl, abuseIPDB, ruleFiles and // tagLists, routeWatchTags, noteLookup, dnsbl, abuseIPDB, ruleFiles and
// coreRuleSet. // coreRuleSet.
tags []string tags []string
// site is, for a question, the host the visitor asked for, which the // 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 site string
// allowed is true for a question answered with DispositionAllow. // allowed is true for a question answered with DispositionAllow.
allowed bool allowed bool
@@ -122,7 +123,6 @@ func (h *handler) startRequest(
decision: decision{ decision: decision{
client: client, client: client,
method: r.Method, method: r.Method,
host: r.Host,
userAgent: r.UserAgent(), userAgent: r.UserAgent(),
requestURI: r.URL.RequestURI(), requestURI: r.URL.RequestURI(),
line: requestlog.Line{ line: requestlog.Line{