]> git.kaiwu.me - haproxy.git/commit
MINOR: http: define http_hdng_chk for ambient hardening checks to be run
authorWilly Tarreau <w@1wt.eu>
Thu, 29 Oct 2026 14:14:45 +0000 (15:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Nov 2026 21:45:32 +0000 (22:45 +0100)
commitf22a81c9fd01675832f3fb0f778561aa4a0da3f0
tree5ef3ab93b195fc29b8b99816a1b2f16f8a9f0209
parentab6ee6b7819d493ffca34385bcd70a9bca44818f
MINOR: http: define http_hdng_chk for ambient hardening checks to be run

In order to enforce HTTP hardening checks, we have to instrument functions
at many different layers of the HTTP parsing code. First tests show that
we might need to add extra parameters to numerous functions, just to
forward requirements and results.

A simpler, less elegant but much more efficient approach consists sharing
the parsing checks globally (local to the thread) so that anywhere in the
HTTP stack it is possible to know what checks are enforced. It is not
different from the global acceptable violations after all, except that
this has to be preset, consumed and cleared by the caller. The benefit
is that it will then be possible to define the checks before parsing,
and let any function anywhere in the chain participate to the operation,
including for reporting possible anomalies.

The http_harden(flag) function does the repetitive part of the check and
returning what final action was performed and should be easy to deploy.
include/haproxy/http-t.h
include/haproxy/http.h
src/http.c