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:
1 parent
17bbea919a
commit
eb1c75d264
2 files changed
+7
-7
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in new issue
Block a user