fix: serve the challenge to clients that do not accept gzip #2
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/anubis!2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/challenge-without-gzip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes Keel-Linux/keel-web#2: the Anubis challenge returned 500 to clients that do not accept gzip.
Root cause
The cause is in Anubis, not in Coraza (common#25's
coraza_delay_response_headers offand the module patch of libnginx-mod-http-coraza#3 are not involved). Upstream 1.27.0'sRenderIndex(lib/http.go) refuses one challenged request in 64, at random, whenAccept-Encodingdoes not containgzip. The refusal goes throughrespondWithError(HTTP 500), with the log lineclient was given a challenge but does not in fact support gzip compression. That line is in Anubis's log of the step 7 run, next to the 500.A missing
Accept-Encodingmeans any coding is acceptable (RFC 9110, 12.5.3), and real clients send none: curl by default, some accessibility and archiving tools, and proxies that strip the header. They got a server error at random and never reached the proof of work, which is the actual defence. Upstream's #1958 (after 1.27.0) only changes the status to the policy's DENY and keeps the sampling, so even with it these clients get an error page instead of the challenge.Change (1.27.0-0+keel2)
debian/patches/challenge-without-gzip.patch(DEP-3) drops the sampled refusal. It addsTestNonGzipClientGetsChallenge: 4096 requests each withoutAccept-Encoding, withidentityand withbr, and all must be challenged. Before the patch it failed at request 67 with status 500.debian/rules:TestChallengeFor_ErrNotFound, skipped as flaky because of this refusal, runs again.behind-nginx: 512 requests withoutAccept-Encodingthrough nginx must all get the challenge page with 200. The old code passes this by chance about once in 3000 runs.Evidence
dpkg-buildpackage -bon trixie with golang-1.26: every Go test passes, including the new one. lintian is clean.Accept-Encodingover HTTPS got 300 × 200;Accept-Encoding: identity(checked in Nginx's log) and got 200 × 200, with no 500 and no gzip refusal in Anubis's journal.Test plan
build / trixie(build plus autopkgtest in the LXC container) green