waf: refusedWhateverTheAnswer in lookup.go, beside its only caller
check / check (push) Failing after 1m47s

It decides whether a request skips the wait for GeoJS, and only
startLookUp calls it. It is not question or report code, so in
questionsandreports.go the file's name did not say what it held.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-20 00:44:27 +00:00
1 parent f9cb1f9c6b
commit 02f9134a05
2 files changed
+20 -20

No files matched your search

+20
View File
@@ -80,6 +80,26 @@ func (rq *request) startLookUp(
return result
}
// refusedWhateverTheAnswer reports whether the request is one that does not wait
// for GeoJS, since the checks will refuse it at now whatever GeoJS answers about
// its client: a heuristic of afterLookup that implements refusesWithoutLookup
// says it will refuse it. In observe mode, which refuses nothing, none is.
// rproxy lets a request through when waf answers too late.
func (rq *request) refusedWhateverTheAnswer(now time.Time) bool {
if rq.h.config.Observe {
return false
}
for _, each := range rq.h.afterLookup {
knows, ok := each.(refusesWithoutLookup)
if ok && knows.refusesWhateverTheLookupAnswers(rq, now) {
return true
}
}
return false
}
// noteLookup notes result for the log line and as the request's asn= and
// country= tags.
func (rq *request) noteLookup(result lookupResult) {
-20
View File
@@ -11,26 +11,6 @@ import (
"sneak.berlin/go/smallwebwaf/internal/wafprotocol"
)
// refusedWhateverTheAnswer reports whether the request is one that does not wait
// for GeoJS, since the checks will refuse it at now whatever GeoJS answers about
// its client: a heuristic of afterLookup that implements refusesWithoutLookup
// says it will refuse it. In observe mode, which refuses nothing, none is.
// rproxy lets a request through when waf answers too late.
func (rq *request) refusedWhateverTheAnswer(now time.Time) bool {
if rq.h.config.Observe {
return false
}
for _, each := range rq.h.afterLookup {
knows, ok := each.(refusesWithoutLookup)
if ok && knows.refusesWhateverTheLookupAnswers(rq, now) {
return true
}
}
return false
}
// answerQuestion runs the checks on the visitor's request a question
// carries, and answers rproxy what to do with it. A denied request's counting
// is finished here, and an allowed one's by its report.