]> git.kaiwu.me - haproxy.git/log
haproxy.git
3 hours agoBUG/MEDIUM: ssl: prevent CN fallback when a SAN extension is present master
William Lallemand [Thu, 26 Nov 2026 17:48:04 +0000 (17:48 +0000)]
BUG/MEDIUM: ssl: prevent CN fallback when a SAN extension is present

Yang Hailong of Alipay Security Team reported that backend hostname
verification accepts a certificate with a URI-only SAN and a matching
subject CN. The fallback was disabled only after encountering a DNS SAN,
so certificates containing other SAN types could still match their CN.

Use the status returned by X509_get_ext_d2i() to allow CN fallback only
when the SAN extension is absent. Present but undecodable or duplicate
SAN extensions do not permit fallback either.

RFC 9525 obsoletes RFC 6125 and prohibits using the subject Common Name
to identify a service. This change does not fully implement that policy:
CN fallback is retained for certificates without a SAN extension to
preserve compatibility with legacy deployments.

This intentionally tightens certificate acceptance: non-DNS SANs now
suppress CN matching, while certificates without SAN retain CN fallback.

Verified with the existing verifyhost regression and live backend TLS
checks covering URI-only SAN rejection, mixed URI/DNS SAN acceptance,
and CN-only compatibility, using both verifyhost and SNI.

This change must not be backported because it changes certificate
acceptance and could break existing deployments on stable branches.

Reported-by: Yang Hailong
6 hours agoBUG/MINOR: ocsp: Increment certificate_ocsp refcount in 'ssl_sock_copy_cert_key_and_c...
Remi Tricot-Le Breton [Thu, 26 Nov 2026 14:38:59 +0000 (15:38 +0100)]
BUG/MINOR: ocsp: Increment certificate_ocsp refcount in 'ssl_sock_copy_cert_key_and_chain'

ssl_sock_copy_cert_key_and_chain() duplicates a ckch_data and duplicates
its ocsp_cid via OCSP_CERTID_dup(). Since the response tree is keyed on
the OCSP_CERTID itself, the copy points to the very same
certificate_ocsp entry as the original ckch_data, but no additional
reference was taken on it.

This was an issue because ssl_sock_free_cert_key_and_chain_contents
unconditionally decrements this certificate_ocsp's refcount_store while
the matching increment was only performed in ssl_sock_load_ocsp(),

If a duplicated ckch_data is freed (an aborted "set ssl cert"
transaction for instance) while the original ckch_store is still alive,
refcount_store can fall to 0 and the shared certificate_ocsp entry be
freed, leaving the original ckch_store with a dangling pointer. The next
OCSP response lookup or update would then use freed memory.

This was reported by brhenc in GitHub issue #3591.

This patch should be backported up to 2.8.

6 hours agoBUG/MINOR: jwe: check that the EC point is on the curve
Gihyeon Ryu [Thu, 26 Nov 2026 14:38:58 +0000 (15:38 +0100)]
BUG/MINOR: jwe: check that the EC point is on the curve

EC_POINT_set_affine_coordinates() returns 0 when the point is not on the
curve, but curve_param_to_pubkey() only treats a negative value as an
error, as do the two tests of the OpenSSL 1.1.1 branch. An off-curve
ECDH-ES "epk" is then rejected later by OpenSSL itself in the tested
version (3.0), so no impact was found, but the check should not rely on
it. The three tests now require a return value of 1.

This may be backported up to 3.4.

7 hours agoBUG/MEDIUM: mux-h2: don't block other streams while waiting for a tunnel
Olivier Houchard [Thu, 26 Nov 2026 14:22:08 +0000 (15:22 +0100)]
BUG/MEDIUM: mux-h2: don't block other streams while waiting for a tunnel

On the backend side, a stream with data to send for a CONNECT before the
server's response is blocked with H2_SF_BLK_MBUSY but stays in the
send_list, and h2_snd_buf() and h2_nego_ff() make the other streams wait
as long as this list is not empty. So all the other streams of the
connection, possibly from other clients with "http-reuse always", are
blocked until the server responds. It can be reproduced with a CONNECT
followed by a DATA frame sent to a server which delays its response, and
a GET on the same backend connection.

The send_list is only for streams which are ready to write. Let's use a
dedicated flag, H2_SF_WAIT_TUNNEL, not part of H2_SF_BLK_ANY, for which
the stream leaves the send_list and is only added back once the tunnel
is established or aborted. This was introduced in 2.4 by commit
f95f87650 ("MEDIUM: mux-h2: Block client data on server side waiting
tunnel establishment"), and must be backported to all supported
versions.

6 hours agoDEV: sslkeylogger: mark it as a debugging tool only quic-interop
Amaury Denoyelle [Thu, 26 Nov 2026 14:32:03 +0000 (15:32 +0100)]
DEV: sslkeylogger: mark it as a debugging tool only

Add a comment to mark sslkeylogger as a debugging tool only. Its usage
in production must be avoided, as Lua access to filesystem on haproxy
runtime is a bad idea which can hurt haproxy traffic handling
performances.

6 hours agoCLEANUP: mux_quic: fix indentation in rcv_buf
Amaury Denoyelle [Thu, 26 Nov 2026 10:23:20 +0000 (11:23 +0100)]
CLEANUP: mux_quic: fix indentation in rcv_buf

Recently added code was badly indented as spaces were used. Adjust the
code to use tabs for alignment.

7 hours agoBUG/MAJOR: h3: prevent demux full BUG_ON() crash with incomplete DATA
Amaury Denoyelle [Thu, 26 Nov 2026 10:06:00 +0000 (11:06 +0100)]
BUG/MAJOR: h3: prevent demux full BUG_ON() crash with incomplete DATA

Function h3_data_to_htx() transcodes a DATA frame into HTX content. If a
truncated frame is received, content is reduced to the data available in
the buffer. However, the code is murky when only the frame header has
been received but its payload is truncated. Content is set to 0 but the
whole function still executes, which is suboptimal.

Worse, this becomes a major issue if QC_SF_DEM_FULL is set in the same
function call. This violates the invariant on this flag, which must only
be set when there is data to read. This triggers a BUG_ON() crash in
rcv_buf callback, which exists to detect unnecessary wakeups.

This is fixed by adjusting h3_data_to_htx() so that it returns early
when no content is available, preventing unnecessary instructions from
being executed. Most importantly, the HTX output buffer is not checked
anymore so the QC_SF_DEM_FULL flag is not set.

This issue is present since the following patch. Prior to it, empty DATA
frames were totally ignored, but this could prevent FIN reporting, hence
its purpose.

  6c706c1a758b1e8bcdfe0816535edbd5c624db80
  BUG/MEDIUM: h3: do not block FIN on empty DATA frame

Thanks to AndyAnh174 for reporting this issue.

This must be backported up to 2.6.

7 hours agoRevert "BUG/MINOR: jwt: Create jwt tree entry even for new empty certificates"
William Lallemand [Thu, 26 Nov 2026 13:33:46 +0000 (14:33 +0100)]
Revert "BUG/MINOR: jwt: Create jwt tree entry even for new empty certificates"

This reverts commit e0783e24263c1bd3ea15837039e4c8b37cabaecf.

Applied the patch twice by accident.

8 hours agoBUG/MINOR: jwt: Create jwt tree entry even for new empty certificates
Remi Tricot-Le Breton [Thu, 26 Nov 2026 10:11:53 +0000 (11:11 +0100)]
BUG/MINOR: jwt: Create jwt tree entry even for new empty certificates

A new empty certificate created by calling "new ssl cert" directly
followed by "commit ssl cert" would not have a corresponding JWT tree
entry created since only the data-loading code paths were covered in the
previous jwt tree related commits.
With this patch we always have a corresponding jwt tree entry for every
ckch_store.

This patch can be backported to 3.4.

8 hours agoBUG/MINOR: jwt: Do not keep ckch_store if jwt tree entry creation failed
Remi Tricot-Le Breton [Thu, 26 Nov 2026 10:11:54 +0000 (11:11 +0100)]
BUG/MINOR: jwt: Do not keep ckch_store if jwt tree entry creation failed

When a full certificate is provided directly as a second argument of the
"jwt_verify_cert" converter, we create the corresponding ckch_store and
insert it in the ckch_store tree so that it's treated as a regular
certificate. This helps in certificate management since that way the
certificate can be updated via the CLI.
With the latest changes in the JWT tree, we now always have a
corresponding JWT tree entry for every ckch_store, regardless of whether
they set the jwt flag or not. And in every other part of the ckch_store
building process apart the one modified in this patch, we were raising
an error and removing the new ckch_store if an error occurred during the
corresponding JWT tree entry creation.
This patch keeps this logic in the 'jwt_tree_load_cert' function as
well.

This patch can be backported to 3.4.

8 hours agoBUG/MEDIUM: jwt: Add refcount to jwt tree entry
Remi Tricot-Le Breton [Thu, 26 Nov 2026 10:11:55 +0000 (11:11 +0100)]
BUG/MEDIUM: jwt: Add refcount to jwt tree entry

During the certificate update process via CLI commands, when calling
'ckch_store_replace', we were removing the previous ckch_store before
recreating a jwt tree entry and inserting the new ckch_store. During the
short time frame between the 'ckch_store_free' and the
'jwt_tree_create_entry_from_store' call we had no corresponding entry in
the jwt tree so a 'jwt_verify' call at this exact moment would fail.

Instead of rethinking the whole tree logic, a reference counter was
added to tree entry so that we can update the JWT tree entry with the
new ckch_store data (pubkey/privkey), increase the reference counter so
that the ckch_store_free call on the old ckch_store does not fully
remove the JWT tree entry.

This patch should be backported to 3.4.

8 hours agoBUG/MINOR: jwt: Create jwt tree entry even for new empty certificates
Remi Tricot-Le Breton [Thu, 26 Nov 2026 10:11:53 +0000 (11:11 +0100)]
BUG/MINOR: jwt: Create jwt tree entry even for new empty certificates

A new empty certificate created by calling "new ssl cert" directly
followed by "commit ssl cert" would not have a corresponding JWT tree
entry created since only the data-loading code paths were covered in the
previous jwt tree related commits.
With this patch we always have a corresponding jwt tree entry for every
ckch_store.

This patch can be backported to 3.4.

8 hours agoDOC: security: a few more clarifications on report processing
Willy Tarreau [Thu, 26 Nov 2026 10:59:49 +0000 (11:59 +0100)]
DOC: security: a few more clarifications on report processing

Let's clarify that only complete reports are considered and the
other ones are ignored. Also a single report first.

14 hours agoMEDIUM: http: reject percent-encoded chars in the authority and Host
Christopher Faulet [Tue, 24 Nov 2026 14:21:04 +0000 (15:21 +0100)]
MEDIUM: http: reject percent-encoded chars in the authority and Host

While RFC3986 permits percent-encoded characters in the authority for a
general usage, it is safer to reject them in HTTP because it could be used
to abuse ACLs based on the host header value. In fact, because it could be
used as a vector of attacks, it seems commonly rejected/not-supported by
servers. So it is safer to do so.

The http_authority_has_forbidden_char() function already rejects a list of
ambiguous characters in the authority and the Host header value for H1, H2
and H3, so percent ('%') is simply added to this list, covering all three
protocol versions at once.

This patch must not be backported.

14 hours agoBUG/MEDIUM: http-htx: normalize Host header carrying the scheme's default port
Christopher Faulet [Tue, 24 Nov 2026 10:19:45 +0000 (11:19 +0100)]
BUG/MEDIUM: http-htx: normalize Host header carrying the scheme's default port

An HTTP/1 absolute-form request-target whose authority carries no port may
be sent with a Host header value carrying the scheme's default port (or an
empty one). h1_validate_mismatch_authority() deliberately accepts both
spellings as equivalent, but http_scheme_based_normalize() only removed the
port when it was found in the URI authority, so the raw ":443" remained in
the Host header value.

As a result the ACLs, the routing rules and the cache key were evaluated on
different values and this could be confusing.

Now the Host header value is also normalized when it carries the scheme's
default port and matches the authority, so the analyser, the rules, the
cache and the forwarded request all see the same canonical host value.

Thanks to Christos Papakonstantinou for the report.

This patch could be backported to stable versions. But it could be good to
wait for a period of observation first.

24 hours ago[RELEASE] Released version 3.5-dev14 v3.5-dev14
Willy Tarreau [Wed, 25 Nov 2026 20:54:46 +0000 (21:54 +0100)]
[RELEASE] Released version 3.5-dev14

Released version 3.5-dev14 with the following main changes :
    - BUG/MINOR: mux-quic: fix QMux Rx buffer leak on MUX init failure
    - BUG/MEDIUM: quic: never advertise more streams than configured
    - BUG/MEDIUM: mux-quic: cap elastic MAX_STREAMS to stream.max-total
    - MINOR: reg-tests: add --extra to run tests needing optional tools
    - REGTESTS: quic: add a Python QUIC client
    - REGTESTS: quic: backend must drop packets with an unsupported version
    - REGTESTS: quic: NEW_CONNECTION_ID must not reference a retired CID
    - REGTESTS: quic: undecryptable 0-RTT packets must not exhaust the Rx buffer
    - BUG/MEDIUM: payload: reject out-of-range payload and payload_lv arguments
    - BUG/MINOR: payload: also encode an absolute payload_lv offset2
    - BUG/MINOR: sample: do not parse compressed gRPC messages in ungrpc
    - REGTESTS: protobuf: cover the gRPC message compression flag
    - DOC: config: ungrpc does not support compressed messages
    - BUG/MEDIUM: http-ana: restore the purge of backend analyzers on applets
    - BUG/MINOR: quic: do not reject CRYPTO data exactly fitting in buffer
    - CLEANUP/MINOR: ncbuf: avoid noop memcpy when data ends on wrapping
    - CLEANUP/MINOR: ncbmbuf: avoid noop memcpy when data ends on wrapping
    - BUG/MINOR: ncbuf/test: remove list dependency for standalone tests
    - BUG/MINOR: ncbuf/test: remove unnecessary delay in random insert
    - MINOR: ncbuf/test: extract random insert test in a dedicated function
    - MINOR: ncbuf/test: define max iteration to random insert test
    - MINOR: ncbuf/test: define seed for random insert test
    - BUG/MEDIUM: hlua: make coroutine.create() safe under haproxy (new attempt)
    - MINOR: hlua: add our own safe coroutine.wrap() wrapper
    - BUG/MINOR: hlua: wait for the request in HTTP applets
    - BUG/MINOR: hlua: reject interim responses in HTTP applets
    - BUG/MINOR: h3: reject interim responses ending the stream
    - BUG/MEDIUM: quic: refuse handshakes completed after the listener unbind
    - BUG/MEDIUM: quic: do not spin on the accept tasklet of a blocked listener
    - BUG/MEDIUM: xprt_qmux: apply the configured bidi streams limit on FE
    - BUG/MEDIUM: log/tools: fix cbor binary integer encoding regression with x86_64 systems
    - MINOR: jwt: Add rwlock to jwt_cert_tree
    - BUG/MEDIUM: jwt: Use only JWT cert tree for jwt_verify
    - BUG/MEDIUM: jwt: Use JWT cert tree for jwt_decrypt
    - BUG/MINOR: ech: keep CLI success messages alive until printed
    - BUG/MINOR: ssl/cli: use the right list member in "add ssl crt-list" release
    - MINOR: ssl: allow prefix lookup for alpn_remove_token()
    - MINOR: ssl/quic: mark hq-interop QUIC ALPN as experimental
    - BUG/MINOR: httpclient/cli: fix NULL dereference when the response has no header
    - BUG/MINOR: ocsp: fix NULL dereference when the OCSP responder sends no header
    - BUG/MINOR: net_helper: check the TCP option length before reading its value
    - BUG/MINOR: net_helper: accept an Ethernet header ending with the protocol
    - BUG/MINOR: resolvers: reject DNS messages without the QR bit
    - BUG/MINOR: intops: reject varints that do not fit in 64 bits in decode_varint()
    - BUG/MINOR: mux-spop: match the AGENT-HELLO and AGENT-DISCONNECT keys exactly
    - BUG/MINOR: mqtt: reject invalid CONNECT flags and MQTT 3.1.1 CONNACK return codes
    - BUG/MINOR: mux-h2: reject non-numeric values in the tune.h2 keywords
    - MINOR: tools: add some of the missing null-terminated integer parsers
    - REORG: tools/intops: move the integer-specific functions from tools to intops
    - REORG: tools/intops: move the int-to-str conversion functions to intops as well
    - CLEANUP: tree-wide: remove unneeded dependencies on tools.h
    - BUG/MEDIUM: stick-tables: update the bucket's next_exp before releasing its lock
    - REGTEST: spoe: fix the SPOP varint encoding in the mock agent
    - REGTEST: spoe: add large-frame tests for the applet and the mux
    - BUG/MINOR: tcpcheck: fix out-of-bounds reads on truncated LDAP bind responses
    - BUG/MINOR: tcpcheck: fix out-of-bounds reads on truncated SPOP hello frames
    - MINOR: jwt: New jwt_verify_secret converter
    - MINOR: jwt: Deprecate jwt_verify converter
    - CLEANUP: mux-h2: get rid of the redundant h2_parse_int() function
    - MINOR: init: automatically turn "set-dumpable" on when using "-d"
    - MINOR: http: use fuzzy-match for the "return" action keywords
    - BUG/MEDIUM: mux-h2: don't stall on a failed rxbuf alloc without stream
    - BUG/MEDIUM: mux-fcgi: let the buffer callback allocate despite the queue
    - BUG/MEDIUM: mux-spop: let the buffer callback allocate despite the queue
    - BUG/MINOR: tcpcheck: fix out-of-bounds read on the MySQL server version
    - BUG/MINOR: vars: fix missing string termination in get var on too long values
    - BUG/MINOR: lua: channel: append() must insert data at the end, not at the start
    - BUG/MINOR: quic: fix uninitialized read of pkt->rs.delivered in ACK processing (BBR)
    - BUG/MINOR: payload: distcc_body must not sample unreceived buffer bytes
    - MEDIUM: config: emit warnings when changing bufsize after other sections
    - BUG/MEDIUM: pattern: check for non-empty string before matching regexes
    - CLEANUP: pattern: don't even run string-based matches on empty strings
    - REGTESTS: mysql: Close server s6 declaration
    - BUG/MEDIUM: acme: take the resolvers lock when linking/unlinking DNS requesters
    - BUG/MEDIUM: mux-fcgi: avoid out-of-bounds path decoding
    - MINOR: filters: Register a dedicated trace source for the filters
    - MINOR: htx: Add a noop block to carry the EOM flag on an empty message
    - DOC: htx: add the NOOP block to the HTX API documentation
    - BUG/MEDIUM: stconn: Do not install an applet on a busy stream connector
    - BUG/MEDIUM: applets: do not wake up applets before the end of the request analysis
    - BUG/MEDIUM: stconn: Only forward kip hint on streams committed to forward data
    - BUG/MEDIUM: mux-h1: never forward more data than announced in a chunk
    - MEDIUM: stconn: Forward kip hint right before the endpoint callback
    - MINOR: tcpcheck: add TCPCHK_EXPT_FL_ALLOW_EMPTY flag on expect rules
    - MINOR: tcpcheck: evaluate custom expect rules on empty response when allowed
    - MEDIUM: tcpcheck: handle MySQL AuthSwitchRequest in mysql-check post-80 modes
    - DOC: config: update mysql-check doc for the auth switch support
    - REGTESTS: mysql-check: refresh the regtest for the auth switch support
    - CLEANUP: tcpcheck: Stop to export most of custom expect functions
    - BUG/MINOR: qmux: prevent pacing BUG_ON() on send syscall zero return
    - MINOR: server: report incorrect usage of "from" keyword
    - MINOR: server: lookup defaults section on "from srv:"
    - MINOR: server: lookup defaults section on "from be:"
    - BUG/MEDIUM: mux-h2: reject non-101 2xx responses to Extended CONNECT
    - MINOR: mux-quic: remove error trace on transport failure
    - DEV: phash: improve the output to permit an easier copy-paste
    - MINOR: http: Add support for HTTP 411 status code
    - MEDIUM: http_ana: control acceptance of 1xx status on HTTP/1.0
    - MINOR: http_ana: always drop the Expect header in HTTP/1.0
    - MEDIUM: http/hardening: delete untrusted headers/trailers with underscore
    - MEDIUM: http/hardening: default to rejecting untrusted duplicate C-L
    - MEDIUM: http/hardening: reject forbidden payload on 1xx/204 responses
    - MEDIUM: http/hardening: filter out-of-range status codes from untrusted servers
    - MINOR: http: add a new violation rule "trace-with-content" for TRACE methods
    - BUG/MEDIUM: acme: match DNS challenges against all TXT records
    - IMPORT: slz: update slz to v1.4.0 (commit 197db002f1)
    - BUG/MINOR: h1: restrict a bit more the syntax of chunk extensions
    - REGTESTS: http-messaging: test the strict parsing of HTTP/1 chunk extensions
    - REORG: h1: move chunk extensions parsing to a dedicated inline function
    - MEDIUM: h1: make h1_parse_chunk_size() rely on h1_parse_chunk_ext()
    - REGTESTS: http-messaging: also test chunk extensions on chunks larger than the buffer
    - MINOR: tools: add memcpy_opt_small() for ultra-small copies
    - OPTIM: h1: use memcpy_opt_small() to copy chunks in the contiguous parser
    - BUG/MINOR: h3: reject reserved HTTP/2 frame types
    - BUG/MINOR: h3: support unknown frames of any length
    - MINOR: http: add -dH at boot to dump HTTP specific settings
    - BUILD: http: fix missing include in haproxy.c
    - BUG/MEDIUM: startup: revisit the default chroot behavior
    - BUG/MINOR: startup: also disable strict limits with -d
    - MINOR: stream: use regular TRACE_* macros for stream traces
    - BUG/MEDIUM: mux-h1: Don't shortcut h1_process() while a stream is attached
    - DOC: config: Properly align table at begining of 7.5
    - REGTESTS: tcp-check-ssl: tolerate an errno info in the SSL handshake failure
    - REGTESTS: tcp-check-ssl: also support errno reporting on second test
    - BUG/MINOR: h3: extend coverage for duplicate SETTINGS ids
    - BUG/MEDIUM: acme: distinguish wildcard CLI and Lua acknowledgements
    - BUG/MEDIUM: lua: handle apex and wildcard challenges in Gandi example
    - DOC: lua: document wildcard ACME authorization readiness
    - DOC: management: document ACME challenge readiness acknowledgements
    - EXAMPLES: acme: add a Lua Gandi DNS-01 configuration
    - BUG/MINOR: ssl: append OCSP base64 newline to the output buffer
    - BUG/MINOR: mux-h1: properly handle NOOP blocks and track EOM emission
    - MINOR: tools: add read_line_to_mem() to read a line into a growing buffer
    - BUG/MINOR: pattern: don't rely on the trash size to read pattern files
    - BUG/MINOR: pattern: do not index too large strings using the tree
    - BUG/MEDIUM: ssl: trim dropped kTLS records from the end of the buffer
    - BUG/MEDIUM: rawsock: don't take a short kTLS read for the end of data
    - BUG/MINOR: resolvers: display the template name instead of "server '(null)'"
    - MEDIUM: server: add a global setting "unresolvable-server-fqdn"
    - BUG/MEDIUM: mjson: stop the lookup when the matched element ends
    - BUG/MEDIUM: mjson: decode the escaped slash in strings
    - DOC: config: mention the nesting limit of the json_query() converter
    - BUG/MEDIUM: ssl/cli: reset the transaction on interrupted CA/CRL commits
    - CI: github: enable slow regression tests for OpenSSL master
    - BUG/MEDIUM: ssl/cli: restore the store conf on "add ssl crt-list" error
    - BUG/MINOR: ssl/ckch: copy the origin of the conf in ckchs_dup()
    - BUG/MEDIUM: ssl/cli: keep the crt-store conf on "add ssl crt-list"
    - BUG/MINOR: ssl/cli: don't clear the jwt flag on "add ssl crt-list"
    - BUG/MINOR: ssl/cli: fix ckch_conf leaks in "add ssl crt-list"
    - BUG/MINOR: cache: free the blocks of aborted stores at once
    - BUG/MEDIUM: cache: build the secondary key on an unusable first entry
    - MINOR: github: disable blank issues
    - MINOR: github: add documentation suggestion template
    - MINOR: http/hardening: implement "reject-advanced-methods"
    - REGTESTS: http-messaging: test reject-advanced-methods
    - MINOR: http/hardening: implement "reject-unexpected-request-payload"
    - REGTESTS: http-messaging: test reject-unexpected-request-payload
    - MINOR: http/hardening: implement "reject-unexpected-request-upgrade"
    - REGTESTS: http-messaging: test reject-unexpected-request-upgrade
    - MINOR: http/hardening: add a new more protective "basic-web" profile
    - REGTESTS: http-messaging: test the "basic-web" profile in http_hardening_profiles

26 hours agoREGTESTS: http-messaging: test the "basic-web" profile in http_hardening_profiles
Willy Tarreau [Wed, 25 Nov 2026 18:07:51 +0000 (18:07 +0000)]
REGTESTS: http-messaging: test the "basic-web" profile in http_hardening_profiles

The implicit "basic-web" profile is now verified: its default settings
are displayed, it may be used on a bind line without being declared
(deleting unregistered and underscored headers, and rejecting TRACE and
GET with a body), and it may serve as a source for "from". The expected
listing of the "untrusted" profile was completed with the three new
checks, which are off there.

26 hours agoMINOR: http/hardening: add a new more protective "basic-web" profile
Willy Tarreau [Wed, 25 Nov 2026 17:32:57 +0000 (18:32 +0100)]
MINOR: http/hardening: add a new more protective "basic-web" profile

This profile enables all the protections that are sufficient for basic
web serving to browsers, i.e. no payload with methods not meant to
support one, no tunnels, no unknown upgrade tokens, no transfer-encoding
in requests, no unregistered headers, no trailers. It should be sufficient
for the vast majority of web sites and can trivially be enabled like this
on public-facing connections:

    http-hardening untrusted from basic-web

http_hardening_profiles.vtc was updated accordingly since "basic-web" now
appears in the "show http-hardening" listings, as implicit when not
declared.

26 hours agoREGTESTS: http-messaging: test reject-unexpected-request-upgrade
Willy Tarreau [Wed, 25 Nov 2026 18:07:51 +0000 (18:07 +0000)]
REGTESTS: http-messaging: test reject-unexpected-request-upgrade

This adds the "reject-unexpected-request-upgrade" check to the HTTP/1
and H2 tests, in its own profile on its own bind line, and an upgrade
to an unknown protocol to the reference connection which has everything
off. Only "websocket" and "webtransport" are kept in the Upgrade header,
which is removed along with "connection: upgrade" once empty, and the
request is not rejected. The frontend now also reports the Upgrade
header in "x-upg". For H2, this is done via extended CONNECT, which is
accepted for "websocket" and "webtransport" and rejected for other
protocols. For websocket, the server is a frontend of the same instance
which computes the Sec-WebSocket-Accept header that haproxy verifies,
as done in websocket.vtc.

26 hours agoMINOR: http/hardening: implement "reject-unexpected-request-upgrade"
Willy Tarreau [Wed, 25 Nov 2026 17:12:49 +0000 (18:12 +0100)]
MINOR: http/hardening: implement "reject-unexpected-request-upgrade"

Rejects Upgrade and RFC8441 Extended CONNECT for protocols other than
"websocket" and "webtransport". For Upgrade, all offending tokens are
removed and the header will be removed if empty, so that it remains
harmless to clients sending tentative upgrades. Upgrade and CONNECT are
commonly abused to try to establish a tunnel with an application and
bypass the reverse-proxy layer, and most applications and browsers do
not implement other protocols, so there is no reason for letting them
pass through with common web applications. It is generally safe for
static web serving and simple internet-facing applications. This is
disabled by default. Note that tunnels established via standard CONNECT
are NOT blocked with this rule, see 'reject-advanced-methods' for this.

26 hours agoREGTESTS: http-messaging: test reject-unexpected-request-payload
Willy Tarreau [Wed, 25 Nov 2026 18:07:51 +0000 (18:07 +0000)]
REGTESTS: http-messaging: test reject-unexpected-request-payload

This adds the "reject-unexpected-request-payload" check to the HTTP/1
and H2 tests, in its own profile on its own bind line, and a GET with a
body and a chunked POST to the reference connection which has everything
off. A payload is accepted with POST, PUT and PATCH, an empty one with
GET, but a non-empty one gets a 400 or STREAM_ERROR with GET, HEAD,
DELETE, OPTIONS and TRACE, as does any chunked request.

26 hours agoMINOR: http/hardening: implement "reject-unexpected-request-payload"
Willy Tarreau [Wed, 25 Nov 2026 16:30:26 +0000 (17:30 +0100)]
MINOR: http/hardening: implement "reject-unexpected-request-payload"

Rejects requests which contain a payload on methods which have no
defined semantics with it (HEAD, GET, DELETE, OPTIONS, CONNECT, TRACE),
as well as any HTTP/1.1 request using the chunked Transfer-Encoding.
This protects backend servers having imperfect implementation against a
wide list of attacks that try to abuse their limited parsing to bypass
their inspection or desynchronize them with haproxy. The vast majority
of applications aimed at browsers will not experience any issue with
this setting, but some in-house or proprietary components might rely on
passing a payload to some of these methods, or uploading streamed data
using Transfer-Encoding. Note that other methods are assumed to support
payloads, and unknown methods might be handled similarly to GET by some
servers. As such, when using this to protect an application, it is wise
to also use 'reject-advanced-methods'. This is generally safe for
static web serving and simple internet-facing applications. It is
disabled by default.

http_hardening_report.vtc was updated accordingly since the new flag
appears (0x20000).

26 hours agoREGTESTS: http-messaging: test reject-advanced-methods
Willy Tarreau [Wed, 25 Nov 2026 18:07:51 +0000 (18:07 +0000)]
REGTESTS: http-messaging: test reject-advanced-methods

This adds the "reject-advanced-methods" check to the HTTP/1 and H2 test, in
its own profile on its own bind line, and TRACE and an unknown method to the
reference connection which has everything off. Only GET, HEAD, POST, PUT,
DELETE, OPTIONS, PATCH and QUERY are accepted, while TRACE, CONNECT (there
is no extended CONNECT in HTTP/1), unknown methods and methods differing
from PATCH or QUERY by their length get a 405 or a stream error.

26 hours agoMINOR: http/hardening: implement "reject-advanced-methods"
Willy Tarreau [Wed, 25 Nov 2026 15:59:49 +0000 (16:59 +0100)]
MINOR: http/hardening: implement "reject-advanced-methods"

Rejects requests whose method is not one of: HEAD, GET, POST, PUT,
DELETE, OPTIONS, PATCH, QUERY, or extended CONNECT (RFC8441). This
is amply sufficient for the vast majority of regular web sites and
applications accessed by browsers, but may not always be compatible
with API aimed at being joined directly by other applications. This can
block by default a significant number of backend vulnerabilities that
are not yet discovered and that are only triggered by less common
methods. Use only after verifying applications compatibility, though
this is safe for static web serving and simple internet-facing
applications. It is disabled by default.

http_hardening_profiles.vtc was updated accordingly: its "base" profile is
built with "all on", which now also rejects the "get" method used there
to check "reject-lowercase-method", so the new check is turned off there.

26 hours agoMINOR: github: add documentation suggestion template
William Lallemand [Wed, 25 Nov 2026 18:21:17 +0000 (18:21 +0000)]
MINOR: github: add documentation suggestion template

Add a Doc suggestions issue form with a single required text area for
documentation suggestions. Apply the type: doc label automatically.

26 hours agoMINOR: github: disable blank issues
William Lallemand [Wed, 25 Nov 2026 18:16:18 +0000 (18:16 +0000)]
MINOR: github: disable blank issues

People with LLMs are creating blank issues instead of using the issue
templates. This makes issues harder for maintainers to triage because the
expected information is missing.

Disable blank issues so reporters are directed to the existing templates.

27 hours agoBUG/MEDIUM: cache: build the secondary key on an unusable first entry
Olivier Houchard [Wed, 25 Nov 2026 17:57:22 +0000 (18:57 +0100)]
BUG/MEDIUM: cache: build the secondary key on an unusable first entry

With "process-vary on", http_action_req_cache_use() returns without
building the secondary key when the first entry found for the primary
key cannot be used, because it is expired, stripped to its early hints
or still being stored. The response is then not stored if it has a Vary
header, since the transaction has no secondary key, and the expired
entry is not removed either. So once the first variant of a resource has
expired, this resource is not cached anymore, until that entry gets
evicted.

Let's build the secondary key in this case too, as was done before
commit 25fcee5b0 ("MEDIUM: cache: emit early hints if configured to do
so"), where an expired first entry was not returned by get_entry(). This
was introduced in 3.5-dev3, no backport is needed.

28 hours agoBUG/MINOR: cache: free the blocks of aborted stores at once
Olivier Houchard [Wed, 25 Nov 2026 17:18:23 +0000 (18:18 +0100)]
BUG/MINOR: cache: free the blocks of aborted stores at once

When a store is aborted, because the object turns out to be larger than
max-object-size or because the stream ends before the end of the
response, its row is reattached to the avail list still holding its
data, but it is in no LRU. With "early-hints on", once such a row
reaches the head of the list, cache_make_room() evicts a valid entry
instead, and the row stays there. These rows pile up and the cache
shrinks until no valid entry is left. Any client can cause this by
requesting such objects or by aborting.

Let's truncate these rows when they are reattached, so that their
blocks are free again immediately. This was introduced by commit
77c4de1ec ("MEDIUM: cache: early hints-aware eviction code") in
3.5-dev3, no backport is needed.

28 hours agoBUG/MINOR: ssl/cli: fix ckch_conf leaks in "add ssl crt-list"
Olivier Houchard [Wed, 25 Nov 2026 17:04:37 +0000 (18:04 +0100)]
BUG/MINOR: ssl/cli: fix ckch_conf leaks in "add ssl crt-list"

On success, cli_parse_add_crtlist() leaks the strings of a ckch_conf in
two cases: when the store takes the conf parsed from the line, its
previous conf is overwritten without being freed, and when the store
already has instances, the parsed conf is only compared to the one of
the store and never freed.

Let's free the conf which is not used by the store. This was introduced
by commit 1bc6e990f ("MEDIUM: ssl/cli: handle crt-store keywords in
crt-list over the CLI") in 3.0-dev12, so this should be backported to
3.0, after commit 29225103f ("BUG/MEDIUM: ssl/cli: restore the store
conf on "add ssl crt-list" error").

28 hours agoBUG/MINOR: ssl/cli: don't clear the jwt flag on "add ssl crt-list"
Olivier Houchard [Wed, 25 Nov 2026 17:04:36 +0000 (18:04 +0100)]
BUG/MINOR: ssl/cli: don't clear the jwt flag on "add ssl crt-list"

When a store without any instance takes the conf parsed from an "add ssl
crt-list" line, its "jwt" flag is overwritten too, while the certificate
is still in the JWT tree. After "add ssl jwt" followed by "add ssl
crt-list", the certificate is no longer listed by "show ssl jwt", it can
be deleted while in use for JWT validation, and the JWT tree is no
longer updated when the certificate is.

Let's keep the flag when it was set. This was introduced by commit
18ff130e9 ("MINOR: jwt: Add new "jwt" certificate option") in 3.3-dev10,
so this should be backported to 3.3.

28 hours agoBUG/MEDIUM: ssl/cli: keep the crt-store conf on "add ssl crt-list"
Olivier Houchard [Wed, 25 Nov 2026 17:04:35 +0000 (18:04 +0100)]
BUG/MEDIUM: ssl/cli: keep the crt-store conf on "add ssl crt-list"

In cli_parse_add_crtlist(), a store without any instance takes the conf
parsed from the line, even when it was declared in a crt-store section.
So adding such a certificate to a crt-list over the CLI silently drops
the settings of its "load" line: the file names are no longer reported
by "show ssl cert", and above all "ocsp-update on" is lost, so no OCSP
update is scheduled for it. A line with other keywords also replaces the
ones of the crt-store, while this is refused in a crt-list file.

Let's only replace the conf when the store doesn't come from a
crt-store, and compare the confs otherwise, as is done at boot. This
relies on the previous patch to work on an updated certificate. This was
introduced by commit 1bc6e990f ("MEDIUM: ssl/cli: handle crt-store
keywords in crt-list over the CLI") in 3.0-dev12, so this should be
backported to 3.0.

28 hours agoBUG/MINOR: ssl/ckch: copy the origin of the conf in ckchs_dup()
Olivier Houchard [Wed, 25 Nov 2026 17:04:34 +0000 (18:04 +0100)]
BUG/MINOR: ssl/ckch: copy the origin of the conf in ckchs_dup()

ckchs_dup() copies the content of the ckch_conf, but not its "used"
field, which tells if the conf comes from a crt-store, from a crt-list,
or is empty. So once a certificate was updated, with "set ssl cert" and
"commit ssl cert" for example, its store looks like it was loaded
without any keyword, and ckch_conf_cmp() applies the wrong rules: adding
a crt-store certificate to a crt-list over the CLI with the very
keywords of its crt-store is refused.

Let's copy that field too. The conf is copied since commit 5b85b81d8
("MINOR: ssl/ckch: handle ckch_conf in ckchs_dup() and
ckch_conf_clean()") in 3.2-dev11, so this should be backported to 3.2.

28 hours agoBUG/MEDIUM: ssl/cli: restore the store conf on "add ssl crt-list" error
Olivier Houchard [Wed, 25 Nov 2026 16:47:42 +0000 (17:47 +0100)]
BUG/MEDIUM: ssl/cli: restore the store conf on "add ssl crt-list" error

In cli_parse_add_crtlist(), a store without any instance adopts the
ckch_conf parsed from the line, but if the line is rejected afterwards,
the error path frees the content of that conf, and the store keeps
pointers to freed strings. They are then printed by "show ssl cert" and
freed again by "del ssl cert". It can be triggered by adding a
certificate created with "new ssl cert" to a crt-list which is a
directory, using crt-store keywords such as "key" or "issuer".

Let's save the previous conf of the store and restore it on error, so
that a rejected line doesn't change the store. This was introduced by
commit 1bc6e990f ("MEDIUM: ssl/cli: handle crt-store keywords in crt-list
over the CLI") in 3.0-dev12, so this should be backported to 3.0.

28 hours agoCI: github: enable slow regression tests for OpenSSL master
William Lallemand [Wed, 25 Nov 2026 14:42:03 +0000 (14:42 +0000)]
CI: github: enable slow regression tests for OpenSSL master

Include the slow regression tests in the nightly OpenSSL master job by
adding slow to REGTESTS_TYPES. Keep the other workflows unchanged.

29 hours agoBUG/MEDIUM: ssl/cli: reset the transaction on interrupted CA/CRL commits
Olivier Houchard [Wed, 25 Nov 2026 16:35:16 +0000 (17:35 +0100)]
BUG/MEDIUM: ssl/cli: reset the transaction on interrupted CA/CRL commits

As was fixed for certificates in commit ca42c37bc ("BUG/MEDIUM: ssl/cli:
reset the ongoing transaction when "commit ssl cert" is interrupted"),
when a "commit ssl ca-file" or "commit ssl crl-file" applet is released
before the end, e.g. because the CLI client left while it was yielding,
the release function frees the new entry but the transaction still
references it, or the old entry, already freed once the new one is
inserted. The next "show", "set", "commit" or "abort" on that file then
uses freed memory, which crashes the process.

Let's reset the transaction in the release functions when the applet did
not reach CACRL_ST_FIN. This was introduced in 2.5 with the commands, by
commits a32a68bd3 ("MEDIUM: ssl: Add "set+commit ssl ca-file" CLI
commands") and a51b339d9 ("MEDIUM: ssl: Add "set+commit ssl crl-file" CLI
commands"), so this should be backported to all stable branches.

29 hours agoDOC: config: mention the nesting limit of the json_query() converter
Olivier Houchard [Wed, 25 Nov 2026 16:17:13 +0000 (17:17 +0100)]
DOC: config: mention the nesting limit of the json_query() converter

The JSON parser does not process documents nested deeper than 20 levels
(MJSON_MAX_DEPTH), so json_query() and the converters relying on it
find nothing located after an element nested deeper than that. Let's
mention it next to the other known limitations of this converter.

This may be backported to all supported versions.

30 hours agoBUG/MEDIUM: mjson: decode the escaped slash in strings
Olivier Houchard [Wed, 25 Nov 2026 15:28:48 +0000 (16:28 +0100)]
BUG/MEDIUM: mjson: decode the escaped slash in strings

RFC 8259 allows the slash to be escaped in JSON strings as "\/", and
some encoders emit it by default (e.g. PHP's json_encode()). But
mjson_unescape() does not know this escape and fails, so no value is
returned for such strings by json_query(), jwt_header_query() and
jwt_payload_query(), nor to the ACME client which extracts strings the
same way. This can be reproduced with req.body,json_query('$.url') on
{"url":"\/a\/b"}.

Let's add the slash to the escapes known by mjson_esc().

This exists since the library was imported in 2.4-dev17 by commit
41007a683 ("MINOR: sample: converter: Add mjson library."). It must be
backported to all supported versions.

30 hours agoBUG/MEDIUM: mjson: stop the lookup when the matched element ends
Olivier Houchard [Wed, 25 Nov 2026 14:53:23 +0000 (15:53 +0100)]
BUG/MEDIUM: mjson: stop the lookup when the matched element ends

When a JSON path component matches, mjson_find() does not detect that
the matching element ends without containing the rest of the path, and
keeps matching the remaining components against what follows. A value
may then be returned for a path which does not exist:

  $.a[0].b on {"a":[{"x":1},{"b":"other"}]}     returns "other"
  $.a[0]   on {"a":[],"b":["other"]}            returns "other"
  $.a.b.c  on {"a":{"b":1},"x":[{"c":"evil"}]}  returns "evil"

This affects json_query(), jwt_header_query() and jwt_payload_query(),
and can be reproduced with req.body,json_query('$.a[0].b') and the first
document above.

Let's stop the lookup when a scalar matches a component while the path
is not finished, when a comma follows the matching element, and when
the container holding it is closed. Commas are also only counted as
array separators when an index is expected. The library fixed part of
this after it was imported, in its commit d2d9e4658 ("Fix #32 - fail
search if value not found in the requested array elem").

This exists since the library was imported in 2.4-dev17 by commit
41007a683 ("MINOR: sample: converter: Add mjson library."). It must be
backported to all supported versions.

30 hours agoMEDIUM: server: add a global setting "unresolvable-server-fqdn"
Willy Tarreau [Sat, 21 Nov 2026 22:09:38 +0000 (23:09 +0100)]
MEDIUM: server: add a global setting "unresolvable-server-fqdn"

Recent fix 612b87e75 ("BUG/MEDIUM: resolvers: reject too long labels
when encoding a name") revealed deployment bugs where users are relying
on DNS labels longer than 63 chars, which have obviously never worked.

The problem is that before they would fail silently and now the config
refuses to start. When configs are orchestrated, often users have long
lost any control on what happens and only have to endure what their
orchestrator decides for them, so it can take ages before they figure
how to fix that.

This patch adds a global option to detect the situation at server
registration time, and to emit a warning and force the server to
maintenance instead of hard-failing. It is only meant to be used as a
workaround for the time it takes to fix the configuration, and must
never be left enabled since it will silently let broken configs start.

It will help to backport this patch where the commit above was backported,
i.e. 2.6, with a change to warn by default and indicating that this will
change in 3.5.

30 hours agoBUG/MINOR: resolvers: display the template name instead of "server '(null)'"
Willy Tarreau [Wed, 25 Nov 2026 14:09:21 +0000 (15:09 +0100)]
BUG/MINOR: resolvers: display the template name instead of "server '(null)'"

When resolvers fail to create a resolution, the server name is printed,
but for templates, the server is not yet assigned so "server '(null)'"
is printed, which is ugly and not really helpful. Let's just fall back
to the template name and indicate it.

This can be backported to all versions.

31 hours agoBUG/MEDIUM: rawsock: don't take a short kTLS read for the end of data
Olivier Houchard [Tue, 24 Nov 2026 17:33:04 +0000 (18:33 +0100)]
BUG/MEDIUM: rawsock: don't take a short kTLS read for the end of data

When a read returns less than requested, raw_sock_to_buf() considers
the socket buffer empty, and reports a shutdown if the poller already
saw one. But on a kTLS socket recvmsg() returns at most one record, so
the following records are never read when the peer's FIN is already
there. With "ktls on" on a server closing without a close_notify right
after its response, the response is lost and a 502 is returned.

Let's not do this for reads using a control message buffer, which are
only used for kTLS.

This was introduced in 3.3-dev7 by commit 3d685fcb7 ("MINOR: xprt: Add
recvmsg() and sendmsg() parameters to rcv_buf() and snd_buf()."). It
must be backported to 3.3.

31 hours agoBUG/MEDIUM: ssl: trim dropped kTLS records from the end of the buffer
Olivier Houchard [Tue, 24 Nov 2026 17:33:04 +0000 (18:33 +0100)]
BUG/MEDIUM: ssl: trim dropped kTLS records from the end of the buffer

With AWS-LC and kTLS, ssl_sock_to_buf() reads the records itself, and
drops the NewSessionTicket and close_notify ones it has just received
using b_del(). But this removes data from the head of the buffer, while
the record was appended at its tail. When the buffer already contains
data, their beginning is lost and the record stays in the buffer,
resulting in a corrupted stream, typically an invalid HTTP response
when a server sends a close_notify right after its response. This
rarely shows up for now, because a kTLS read is almost always the last
one of a call.

Let's use b_sub() to remove the record from the tail.

This was introduced in 3.3-dev7 by commit 5da354098 ("MEDIUM: ssl:
Handle non-Application data record with AWS-LC"). It must be backported
to 3.3.

34 hours agoBUG/MINOR: pattern: do not index too large strings using the tree
Willy Tarreau [Wed, 25 Nov 2026 10:20:55 +0000 (11:20 +0100)]
BUG/MINOR: pattern: do not index too large strings using the tree

In pat_idx_tree_str(), we have to fall back to the list also when
trying to index strings that are larger than the encoded bit depth,
i.e. 4095 bytes including the trailing zero. Anyway at such lengths
there cannot be that many strings (due to memory usage) and lists
will probably not be much more expensive than trees.

This needs to be backported to all versions.

34 hours agoBUG/MINOR: pattern: don't rely on the trash size to read pattern files
Dongwon Jang [Tue, 17 Nov 2026 01:47:22 +0000 (10:47 +0900)]
BUG/MINOR: pattern: don't rely on the trash size to read pattern files

Since commit 3ef263987 ("MEDIUM: chunks: Realloc trash buffers only after
the config is parsed and checked") in 1.8, the trash keeps its early
default size (BUFSIZE) until init_trash_buffers() is called after
check_config_validity(). Pattern files (maps, ACL "-f" files and
set-vars-from-map files) are loaded before that point, and their lines are
read with fgets() into the trash. As a result, a line longer than BUFSIZE-1
(16383 by default) is silently split regardless of tune.bufsize: the first
part is loaded with a truncated value and the remainder is loaded as one or
more extra entries, without any warning. For ACLs, this also means that the
16383-char prefix of a long pattern matches while the full pattern does
not. The only workarounds are to shorten such lines or to set the entries
again from the CLI after each reload.

Let's read pattern file lines with read_line_to_mem() instead, which uses
a dedicated heap buffer that grows as needed. Resizing the trash earlier
was not an option since ACL files are loaded while parsing. Values remain
bounded at runtime by tune.bufsize since pattern_exec_match() copies the
matched sample into a trash chunk, which is consistent with what can be
set from the CLI.

A reg-test was added which checks that a map file and an ACL file holding
a single 20000-char line are each loaded as a single entry, and that the
map value is returned in full.

This fixes GitHub issue #3537.

This should be backported to all stable versions, along with the previous
commit "MINOR: tools: add read_line_to_mem() to read a line into a growing
buffer" which it depends on. Before 3.0, the two pat_ref_read_from_file*()
functions take the file name as an argument, which only changes the patch
context.

34 hours agoMINOR: tools: add read_line_to_mem() to read a line into a growing buffer
Dongwon Jang [Tue, 17 Nov 2026 01:33:04 +0000 (10:33 +0900)]
MINOR: tools: add read_line_to_mem() to read a line into a growing buffer

read_line_to_trash() reads the first line of a file into the trash, so
longer lines are truncated to the trash size. Some callers need to read
lines of any length from an already opened file instead, such as the
pattern file readers, which run before the trash is resized to
tune.bufsize.

read_line_to_mem() reads the next line of a file into a caller-provided
heap buffer that grows as needed, as parse_cfg() does for configuration
lines. Unlike read_line_to_trash(), the trailing LF is kept. A full buffer
is detected by checking whether fgets() overwrote its last byte rather
than from the string length, so that lines containing NUL bytes are read
entirely as well. getline() is not used since it was removed for
portability reasons by commit fbc3d46b9 ("BUILD: stats: remove non
portable getline() usage").

It will be used by the next commit to fix the pattern file readers, and
will have to be backported along with it.

38 hours agoBUG/MINOR: mux-h1: properly handle NOOP blocks and track EOM emission
Christopher Faulet [Tue, 24 Nov 2026 21:22:47 +0000 (22:22 +0100)]
BUG/MINOR: mux-h1: properly handle NOOP blocks and track EOM emission

An HTX NOOP block may carry the EOM flag, notably when the end of the
message is reported on an empty HTX message. This is what happens when
an H3 request is received with trailers that do not end the stream:
h3_trailers_to_htx() emits an EOT block without the EOM flag when the
FIN was not received with the trailers, and when the FIN later arrives
in a separate empty STREAM frame, which is valid per RFC 9114,
qcs_http_handle_standalone_fin() calls htx_set_eom() which adds a NOOP
block carrying the EOM flag. On an H1 server, this block arrives after
the H1 mux reached the DONE state, which was a processing error: the
request failed with a 500 and "IH--" (or "ID--") termination flags.

The H1 mux now tracks the EOM emission with a new H1S_F_EOM_SENT flag,
set when the last chunk is emitted (h1_make_eoh, h1_make_data) or when
the EOT block carrying EOM is processed in h1_make_trailers. The new
h1_make_done() function handles the DONE state: it consumes NOOP
blocks, reporting the EOM on the first one carrying the flag, and skips
RAW_DATA blocks after a tunnel rejection on the backend side, replacing
the now removed h1_skip_tunnel() function. This way, a late EOM block
received in DONE state properly terminates the message instead of
raising a processing error.

This also fixes the EOM reporting on an empty HTX message by applets and
HTTP analyzers, which produced a NOOP block rejected by the DONE-state
processing.

This fix must not be backported because it relies on HTX changes
performed in 3.5.

2 days agoBUG/MINOR: ssl: append OCSP base64 newline to the output buffer
William Lallemand [Tue, 24 Nov 2026 17:15:34 +0000 (17:15 +0000)]
BUG/MINOR: ssl: append OCSP base64 newline to the output buffer

ssl_ocsp_response_print_base64() encodes the response into the output
buffer, but attempts to append the trailing newline to the stored OCSP
response instead. As a result, the base64 dump lacks its terminating
newline.

Stored responses are allocated by chunk_dup() with at most one spare
byte. Since chunk_appendf() also needs room for a terminating NUL, this
does not extend the stored response, contrary to the reported impact.

Append the newline to the output buffer instead. The separate missing
OCSP lock in the CLI detail handler is not addressed by this patch.

Verified with 100 repeated CLI dumps and TLS stapling before and after
the reads. Each dump decodes to the original OCSP response.

Reported by brhenc in GitHub issue #3593:
https://github.com/haproxy/haproxy/issues/3593

The bug was introduced in 9c4437d02 ("MINOR: ssl: Add way to dump ocsp
response in base64"), first released in 2.8.

This fix should be backported to all maintained branches since 2.8.

2 days agoEXAMPLES: acme: add a Lua Gandi DNS-01 configuration
William Lallemand [Tue, 24 Nov 2026 16:42:04 +0000 (16:42 +0000)]
EXAMPLES: acme: add a Lua Gandi DNS-01 configuration

Add a configuration loading the Gandi LiveDNS Lua handler with an ACME
section using Let's Encrypt staging and combined CLI/DNS readiness. Show
the certificate store and TLS frontend using the managed certificate,
and list the Lua, API-token and RRset ownership requirements.

2 days agoDOC: management: document ACME challenge readiness acknowledgements
William Lallemand [Tue, 24 Nov 2026 15:41:40 +0000 (15:41 +0000)]
DOC: management: document ACME challenge readiness acknowledgements

Document acme challenge_ready on the master CLI and admin stats socket,
including exact apex versus wildcard selection, separate acknowledgement
of pending authorizations, and preservation of both TXT values at a
shared owner.

Explain the remaining readiness conditions and shell quoting.

This must be backported to 3.4 with the wildcard CLI readiness fix.

2 days agoDOC: lua: document wildcard ACME authorization readiness
William Lallemand [Tue, 24 Nov 2026 15:41:34 +0000 (15:41 +0000)]
DOC: lua: document wildcard ACME authorization readiness

Describe the literal *.domain identifier accepted by
ACME.challenge_ready(), the wildcard deployment-event flag, and the
unchanged base-domain field used for DNS publication.

Explain that each pending apex or wildcard authorization must be
acknowledged separately and that their TXT tokens share the same DNS
owner.

No backport is needed: ACME.challenge_ready() and the deployment events
were introduced in 3.5. This documents the preceding wildcard readiness
API fix.

2 days agoBUG/MEDIUM: lua: handle apex and wildcard challenges in Gandi example
William Lallemand [Tue, 24 Nov 2026 15:41:29 +0000 (15:41 +0000)]
BUG/MEDIUM: lua: handle apex and wildcard challenges in Gandi example

The Gandi deployment callback acknowledges wildcard authorizations using
the base domain and overwrites the TXT RRset with one token at a time. A
certificate covering both identifiers can therefore lose a required
token or leave its wildcard authorization waiting.

Accumulate tokens per certificate and base domain, publish the complete
list, and serialize yielding PUTs with a queue-backed lock. Release the
lock on HTTP errors and acknowledge wildcard authorizations using their
literal *.domain identifier. Remove the pre-publication DELETE and skip
cleanup for records that were never deployed.

The example remains dependency-free. Its existing ownership limitation
is unchanged: publication replaces unrelated TXT values and cleanup
removes the whole RRset.

No backport is needed: the Gandi example was introduced in 3.5 by
d2c9bf70e5 ("EXAMPLES: lua/acme: add a dns-01 handler for Gandi LiveDNS
API"). It requires the preceding wildcard readiness API fix.

2 days agoBUG/MEDIUM: acme: distinguish wildcard CLI and Lua acknowledgements
William Lallemand [Tue, 24 Nov 2026 15:41:22 +0000 (15:41 +0000)]
BUG/MEDIUM: acme: distinguish wildcard CLI and Lua acknowledgements

Wildcard and non-wildcard authorizations expose the same base DNS name.
Matching readiness on that name alone acknowledges both authorizations
after only one token has been deployed, while a literal wildcard
identifier cannot match.

Retain the authorization's wildcard flag and match it together with the
base domain. Accept *.domain only for the wildcard authorization, expose
the flag in Lua deployment events, and print the matching CLI command
without changing the DNS TXT owner.

The CLI bug dates back to 9ee14ed2d9 ("MEDIUM: acme: allow to wait and
restart the task for DNS-01"), also backported to 3.2 as c68fc8a9be. The
shared helper and Lua readiness API were introduced in 3.5.

This must be backported to 3.4, 3.3 and 3.2. Adapt the CLI fix to their
inline CLI handlers; the Lua helper and deployment-event changes are
3.5-only and must not be backported as new features.

2 days agoBUG/MINOR: h3: extend coverage for duplicate SETTINGS ids
Amaury Denoyelle [Tue, 24 Nov 2026 14:43:22 +0000 (15:43 +0100)]
BUG/MINOR: h3: extend coverage for duplicate SETTINGS ids

RFC 9114 forbids the emission of duplicate settings IDs in the same
frame. The receiver may report an error when this occurs.

Settings IDs are expressed as QUIC varint and their range is thus quite
large. As a convenience, only the smallest IDs set is checked, which
matches the most frequent usage.

A mistake in the previous code restricts unnecessarily the check to IDs
less than sizeof long, so typically only IDs from 0 to 7 are really
checked on a 64-bit platform. Fix this by multiplying sizeof() by 8,
covering all IDs up to 63 (31 on a 32-bit platform).

This should be backported up to 2.6 after a period of observation.

2 days agoREGTESTS: tcp-check-ssl: also support errno reporting on second test
Amaury Denoyelle [Tue, 24 Nov 2026 15:30:55 +0000 (16:30 +0100)]
REGTESTS: tcp-check-ssl: also support errno reporting on second test

The following patch adjusts the regexp pattern tested against health
check reported info, as newer OpenSSL now also provides an additional
errno status.

  5e92b1a23b0e7065e4dbef52c8a31d8ce03ae309
  REGTESTS: tcp-check-ssl: tolerate an errno info in the SSL handshake failure

This new check is fine, but the fix is not sufficient as a similar
pattern is reused later. Adjust it as well to ensure the test does not
fail anymore.

2 days agoREGTESTS: tcp-check-ssl: tolerate an errno info in the SSL handshake failure
Christopher Faulet [Tue, 24 Nov 2026 14:47:26 +0000 (15:47 +0100)]
REGTESTS: tcp-check-ssl: tolerate an errno info in the SSL handshake failure

With some recent SSL libraries, the info reported by the health check on
server be3/srv may include an errno info after the "SSL handshake failure"
message (e.g. "SSL handshake failure (broken pipe)"), making the S3 syslog
expectation fail to match. The pattern now tolerates any suffix inside the
info quotes, after the two known messages.

2 days agoDOC: config: Properly align table at begining of 7.5
Christopher Faulet [Tue, 24 Nov 2026 10:02:50 +0000 (11:02 +0100)]
DOC: config: Properly align table at begining of 7.5

The HTML rendering of tables does not seem to be performed if there is an
indentation. So let's remove it in the section 7.5 ("Secure filtering of
HTTP requests").

2 days agoBUG/MEDIUM: mux-h1: Don't shortcut h1_process() while a stream is attached
Christopher Faulet [Mon, 23 Nov 2026 14:44:29 +0000 (15:44 +0100)]
BUG/MEDIUM: mux-h1: Don't shortcut h1_process() while a stream is attached

Commit 8fc09da21 ("BUG/MEDIUM: mux-h1: don't drop pending output on a short
content-length") generalized the condition in h1_process() that releases an
H1 connection ASAP from delayed silent shutdowns to any connection in
CLOSING state with an empty output buffer. But it also caught connections
still in CLOSING with an H1 stream attached, which is exactly what
h1_close() leaves behind when the shutdown is performed while the stream is
not detached yet.

On the backend side of a tunnel after a 101 Switching Protocols, this is
fatal: when the stream forwards the client's half-close, h1_close() sets the
h1c to CLOSING but keeps the h1s attached. On the next wakeup, h1_process()
enters the release block, and, because the state is not RUNNING, it calls
h1_close() (a no-op) and jumps to the end, skipping the final
h1_wake_stream_for_recv() call. With H1C_F_WANT_FASTFWD set the mux does not
read the transport itself and never re-subscribes, so the server's data and
FIN are not seen until the shut timeout fires (timeout server). Websocket
sessions half-closed by clients then stall for timeout server and end with
SD--/sD-- instead of ending promptly with ----.

Now, the release block is only entered when no H1 stream is attached, or
when a silent shutdown was requested. This preserves the short
content-length fix (in that case h1s_destroy() has already set h1c->h1s to
NULL when h1_close() leaves the h1c in CLOSING) while restoring the
pre-8fc09da21 behavior for connections with an attached stream.

H1C_F_SILENT_SHUT must remain part of the condition because it is the only
case where an H1C in CLOSING state with an attached stream must still be
released as soon as its output buffer is drained: a silent (dirty) shutdown
means we never send a clean FIN to the peer (conn_sock_shutw() skips
shutdown(SHUT_WR)), so nothing can happen on the connection anymore and the
stream will never have data to fast-forward. It is set on aborted/torn-down
streams and on delayed dirty shutdowns, where the peer will never
acknowledge the close.  Dropping it from the condition would resurrect the
bug fixed by 753083041 ("BUG/MEDIUM: mux-h1: Handle delayed silent shut in
h1_process() to release H1C", issues #1448/#1453): such connections would
linger until the client or server timeout instead of being released once the
last pending bytes are sent.

This patch should fix issues #3579 and #3601. It must be backported wherever
8fc09da21 was backported, so at least as far as 2.8.

2 days agoMINOR: stream: use regular TRACE_* macros for stream traces
Christopher Faulet [Mon, 23 Nov 2026 14:23:41 +0000 (15:23 +0100)]
MINOR: stream: use regular TRACE_* macros for stream traces

The stream trace messages are only emitted when HAProxy is compiled in
DEBUG mode, because they rely on the DBG_TRACE_* macros that are no-ops
unless DEBUG_DEV or DEBUG_FULL is defined.

Now the stream traces are enabled in any build with USE_TRACE, all the
DBG_TRACE_* macros in the stream trace sources were replaced by the
regular TRACE_* macros:

  * src/stream.c: 23 DBG_TRACE_* -> TRACE_*
  * src/backend.c: 44 DBG_TRACE_* -> TRACE_*
  * src/http_ana.c: 61 DBG_TRACE_* -> TRACE_*
  * src/tcp_rules.c: 8 DBG_TRACE_* -> TRACE_*

All these files use the 'strm' trace source, so their messages are now
available via 'trace strm' in non-DEBUG builds.

2 days agoBUG/MINOR: startup: also disable strict limits with -d
Willy Tarreau [Tue, 24 Nov 2026 14:22:06 +0000 (15:22 +0100)]
BUG/MINOR: startup: also disable strict limits with -d

With commit 62c0c84b81 ("MINOR: init: automatically turn
"set-dumpable" on when using "-d""), an interesting issue arrived:
if started as an unprivileged user with ulimit -c forced to zero,
then an error is reported saying it's not possible to raise the
limit, and the process fails to start. This is ridiculous but logical
and can easily be dealt with because this only happens when the
strict-limits are set. Let's have -d also turn the strict limits off.

No backport is needed.

2 days agoBUG/MEDIUM: startup: revisit the default chroot behavior
Willy Tarreau [Tue, 24 Nov 2026 13:58:57 +0000 (14:58 +0100)]
BUG/MEDIUM: startup: revisit the default chroot behavior

A few users reported the following pattern at boot:

  geteuid()                               = 1000
  prctl(PR_CAPBSET_READ, CAP_SYS_CHROOT)  = 1
  mkdir("/tmp/haproxy.wbFFQW", 0700)      = 0
  chdir("/tmp/haproxy.wbFFQW")            = 0
  rmdir("/tmp/haproxy.wbFFQW")            = 0
  chroot(".")                             = -1 EPERM (Operation not permitted)
  geteuid()                               = 1000
  getegid()                               = 1000
  unshare(CLONE_NEWUSER)                  = 0
  chroot(".")                             = -1 EPERM (Operation not permitted)

I.e. everything looks like we'llb be able to chroot but we fail to. And
that's pretty annoying because it reports a warning after that, speaking
about starting as root while it is not the case.

A first approach would consist in relaxing the rules around "auto" but
that's not good because users writing "chroot auto" *want* a chroot to
be performed (and it's actually the safest one since it has no "." nor
"..").

This patch clarifies the situation by introducing a new "opportunistic"
mode, that noone needs to type since it's the default. In this mode, no
error is reported during the attempt to chroot. However on failure, if
the user was root, a warning is reported to indicate that it's strange,
and suggests to use chroot / instead if needed.

In this case the conditions producing the trace above will no longer
display any irritating message on a config without chroot directive,
but users of "chroot auto" will still be told what's wrong.

This only affects 3.5 so no backport is needed.

2 days agoBUILD: http: fix missing include in haproxy.c
Amaury Denoyelle [Tue, 24 Nov 2026 13:12:00 +0000 (14:12 +0100)]
BUILD: http: fix missing include in haproxy.c

Add <haproxy/http.h> in haproxy.c. This fixes the undeclared usage of
http_dump_settings(). This is required since the following patch.

  commit aa6d03899746e0c86f2d0986bf80fd826d2c4196 (haproxy.org/master, haproxy.org/HEAD)
  MINOR: http: add -dH at boot to dump HTTP specific settings

No need to backport.

2 days agoMINOR: http: add -dH at boot to dump HTTP specific settings
Willy Tarreau [Tue, 24 Nov 2026 10:12:19 +0000 (11:12 +0100)]
MINOR: http: add -dH at boot to dump HTTP specific settings

The new -dH option will dump HTTP specific  settings is supported is
-dHall (alias for -dH and lists all info), -dHhelp (which lists all
available settings), and -dHharden (which dumps HTTP hardening
profiles and their default values).

The doc was clarified on where the default values come from, and how
to get such information.

This should address github issue #3606. Thanks to Nick Ramirez for
bringing this topic.

2 days agoBUG/MINOR: h3: support unknown frames of any length
Amaury Denoyelle [Tue, 24 Nov 2026 09:29:04 +0000 (10:29 +0100)]
BUG/MINOR: h3: support unknown frames of any length

Extension frames, when unknown, must be ignored as required by RFC
9114. This is already implemented in the HTTP/3 parser.

Improve the handling of extension frames so that payloads larger than
the buffer size are allowed. This only requires relaxing the frame type
test for streaming parsing. The re-entrancy mechanism relying on the
<demux_frame_type> and <demux_frame_len> members is already implemented
for DATA handling.

Previously, such frames caused a connection closure with the error code
H3_EXCESSIVE_LOAD.

This must be backported up to 2.6 after a period of observation.

2 days agoBUG/MINOR: h3: reject reserved HTTP/2 frame types
Amaury Denoyelle [Tue, 24 Nov 2026 09:56:15 +0000 (10:56 +0100)]
BUG/MINOR: h3: reject reserved HTTP/2 frame types

RFC 9114 defines HTTP/2 frame types with no correspondence in HTTP/3 as
reserved. They must not be sent. Upon receipt, the connection must be
closed with an H3_FRAME_UNEXPECTED error.

Enum h3_ft has been extended to cover these reserved values. Implement
the proper rejection of these types in h3_check_frame_valid().

This must be backported up to 2.6.

2 days agoOPTIM: h1: use memcpy_opt_small() to copy chunks in the contiguous parser
Willy Tarreau [Tue, 24 Nov 2026 08:46:37 +0000 (08:46 +0000)]
OPTIM: h1: use memcpy_opt_small() to copy chunks in the contiguous parser

The contiguous chunks parser copies each chunk's payload into the HTX
block using memcpy(). With tiny chunks, the call to the libc's memcpy()
for a copy of unknown size costs much more than the copy itself, about
20% of the time spent on a stream of 1-byte chunks. Let's use the new
memcpy_opt_small() instead, which copies chunks of up to 32 bytes inline.

The transferred data rates were measured for various chunk sizes
on a Zen4 CPU core at 5 GHz (256 MB block):

  chunk size    before (MB/s)  after (MB/s)        gain
  1                 1350           1594          +18.1%
  1 + ";1"          1327           1656          +24.8%
  1 + ";a=b"        1454           1776          +22.2%
  1 + ";a=\"b\""    1529           1790          +17.1%
  2                 1429           1707          +19.4%
  3                 1641           1898          +15.7%
  4                 1665           2030          +21.9%
  7                 1904           2275          +19.5%
  8                 1968           2493          +26.7%
  15                2542           2798          +10.1%
  16                2558           2776           +8.5%
  17                2554           2754           +7.8%
  24                2816           3012           +7.0%
  32                3018           3167           +4.9%
  33                3093           2993           -3.2%
  40                3073           3014           -1.9%
  100               3664           3611           -1.4%
  1000              4097           4010           -2.1%
  4096+             4100           4074           noise
  random 1..16      1314           1554          +18.3%

Chunks larger than 32 bytes lose a little because the call to memcpy()
is now after a few tests, but the gains, especially in attacks, is
significant.

2 days agoMINOR: tools: add memcpy_opt_small() for ultra-small copies
Willy Tarreau [Tue, 24 Nov 2026 08:46:37 +0000 (08:46 +0000)]
MINOR: tools: add memcpy_opt_small() for ultra-small copies

Some parsers need to copy many tiny objects of variable size (e.g. HTTP/1
chunks of a few bytes), for which calling the libc's memcpy() costs much
more than the copy itself, because the compiler cannot inline a copy
whose size it does not know.

memcpy_opt_small() copies sizes from 1 to 32 inline after two to four
tests, using at most two possibly overlapping fixed-size copies that the
compiler turns into simple loads and stores: one byte then 2 bytes at the
end for 1 to 3 bytes, then 4, 8 or 16 bytes at each end for 4 to 7, 8 to
16 and 17 to 32 bytes respectively. Larger sizes fall back to memcpy(). A
size of zero is not supported since one byte is always copied.

2 days agoREGTESTS: http-messaging: also test chunk extensions on chunks larger than the buffer
Willy Tarreau [Mon, 23 Nov 2026 19:12:36 +0000 (19:12 +0000)]
REGTESTS: http-messaging: also test chunk extensions on chunks larger than the buffer

The contiguous chunks parser leaves a chunk larger than the room left
in the HTX to h1_parse_chunk_size(), which parses its size line on its
own. Let's replay the regular chunk cases with a 16kB chunk to cover
this path as well: valid ones must be forwarded with their data, and
invalid ones rejected on the size line without reaching the server
(a mistakenly accepted request would wait for its data and time out,
also with a 400, hence the dedicated server that must never be
reached).

2 days agoMEDIUM: h1: make h1_parse_chunk_size() rely on h1_parse_chunk_ext()
Willy Tarreau [Mon, 23 Nov 2026 21:14:28 +0000 (21:14 +0000)]
MEDIUM: h1: make h1_parse_chunk_size() rely on h1_parse_chunk_ext()

h1_parse_chunk_size() is used for chunks larger than the room left in
the HTX and for lines wrapping at the buffer's end. It still had its own
lax extensions parser, which only rejected CTLs and mismatched quotes,
so that the strict syntax enforced by the contiguous parser could be
bypassed by sending a chunk larger than the buffer.

It now parses the whole line (size, extensions, CRLF) with the same
reverse index on the contiguous part of the buffer, and relies on
h1_parse_chunk_ext() for the extensions. When the line crosses the
buffer's end, the buffer is realigned in place, as is already done for
headers and trailers, and the parsing restarts. This removes the
per-byte wrapping checks of this slow path.

2 days agoREORG: h1: move chunk extensions parsing to a dedicated inline function
Willy Tarreau [Mon, 23 Nov 2026 22:23:17 +0000 (22:23 +0000)]
REORG: h1: move chunk extensions parsing to a dedicated inline function

The chunk extensions parser of the contiguous chunks parser is moved as-is
to h1_parse_chunk_ext() in h1.h so that it can be shared with the generic
chunk-size parser instead of being duplicated and maintained twice. It
works on contiguous memory with the reverse index convention of the
contiguous parser (end[ridx], ridx < 0 reaching zero at the end of the
input) and returns the new index of the final CR, 0 if more data are
needed, or the opposite of the faulty char's index. It is force-inlined
since streams of tiny chunks each carrying an extension (e.g.
"1;1\r\n1\r\n") must not cost a function call per chunk.

Only the exits were adapted: on the CR, the function returns its index
after checking the pending BWS/equal/quote states, and the CRLF is now
checked by the caller. Running out of data returns 0, and errors return
the opposite of the faulty char's index.

2 days agoREGTESTS: http-messaging: test the strict parsing of HTTP/1 chunk extensions
Willy Tarreau [Mon, 23 Nov 2026 18:20:43 +0000 (18:20 +0000)]
REGTESTS: http-messaging: test the strict parsing of HTTP/1 chunk extensions

Chunk extensions must exactly follow the BNF from RFC9112#7.1.1. This
sends 20 valid and 37 invalid chunk-size lines (on regular and last
chunks) in requests, and a few of them in responses, and checks that
valid ones are forwarded with their body while invalid ones are
rejected with a 400 (or a 502 for responses) without reaching the
server.

Each message is sent in a single write so that it is parsed by the
contiguous chunks parser (h1_parse_full_contig_chunks()). The generic
h1_parse_chunk_size() is only used when the buffer wraps or the HTX is
full, which cannot reliably be reproduced here.

2 days agoBUG/MINOR: h1: restrict a bit more the syntax of chunk extensions
Willy Tarreau [Thu, 5 Nov 2026 17:44:09 +0000 (18:44 +0100)]
BUG/MINOR: h1: restrict a bit more the syntax of chunk extensions

This is a complement of commit 35d63cc3c7 ("MEDIUM: h1: strictly verify
quoting in chunk extensions") in 3.4-dev4, which focused on better
dealing with quotes in chunk extensions due to some agents being
confused by the quotes there. The exact syntax of chunk extensions is:

  *( BWS ';' BWS <name> [ BWS '=' BWS <value> ] )

  where:
    name:  <token>
    value: <token> / <quoted_string>

BWS stands for "bad whitespace", a WS that might be received from legacy
senders but that new ones must not send.

There were a few aspects above that we didn't check:
  - no space is permitted before the CRLF
  - the value may not be empty
  - name must exclusively be a token
  - value must exclusively be a token if not a quoted string

This is important because bad parsers have been caught in the past
swalloing the CRLF at wrong places (inside quotes mainly), and we must
make sure that we're not receiving a mis-quoted extension that could
have fooled an upstream reverse-proxy that got its framing wrong.

This commit improves the state machine to take care ofthe equal sign,
check for BWS around and non-empty value, and make sure that <name>
is a token. It looks like a big change but actually it's a linear
parsing of simple elements and it simplifies the previous parser
that was relying on multiple states in a loop and was wrong.

This is marked minor because most of the sensitive job was in the
commit above, this one only slightly tightens it (and anyway nobody
uses chunk extensions). It could make sense to backport this where
the commit above was backported, after a period of observation.

2 days agoIMPORT: slz: update slz to v1.4.0 (commit 197db002f1)
Willy Tarreau [Tue, 24 Nov 2026 08:19:00 +0000 (09:19 +0100)]
IMPORT: slz: update slz to v1.4.0 (commit 197db002f1)

This fixes a bug that doesn't affect haproxy (in case USLZ_FAST_BITS
is set higher than 9 bits), cleans up the code by moving all tables to
slz-tables.h, improves uslz's performance on dynamic tables (which we
now use a lot with text) by not interrupting their decoding when they
alternate with matches (+15% perf on web with 16 kB buffers). This is
now a tagged version, fixes will be picked from branch stable-1.4.

2 days agoBUG/MEDIUM: acme: match DNS challenges against all TXT records
William Lallemand [Mon, 23 Nov 2026 18:07:54 +0000 (18:07 +0000)]
BUG/MEDIUM: acme: match DNS challenges against all TXT records

A certificate covering a domain and its wildcard requires two dns-01 TXT
values at the same _acme-challenge name. The DNS parser retains both
records, but the ACME resolver callback only copied the first one. With
challenge-ready dns, one authorization could therefore never match its
expected value and renewal would time out.

Copy all TXT records into an owned singly linked list in one response-tree
traversal, using istdup() for each value. Match each challenge against any
entry and free the complete list on replacement, allocation failure, and
resolver teardown. Keep successful empty-list responses valid as before
and leave CLI readiness unchanged.

This should be backported to 3.4, where the DNS propagation pre-check was
introduced by 631fd5f99b.

2 days agoMINOR: http: add a new violation rule "trace-with-content" for TRACE methods
Willy Tarreau [Mon, 23 Nov 2026 16:53:32 +0000 (17:53 +0100)]
MINOR: http: add a new violation rule "trace-with-content" for TRACE methods

The TRACE method must not be used with a content according to the latest
specifications, as it can be used to build smuggling attacks depending on
server implementations. This is blocked as a violation, and can be released
via "trace-with-content" if there is a compelling reason (there should not
be any).

2 days agoMEDIUM: http/hardening: filter out-of-range status codes from untrusted servers
Willy Tarreau [Mon, 23 Nov 2026 15:32:46 +0000 (16:32 +0100)]
MEDIUM: http/hardening: filter out-of-range status codes from untrusted servers

The new rule "reject-out-of-range-status" is used to reject status codes
below 100 or above 599. They are never used except in local deployments,
and are handled differently by different implementations, so let's block
them by default on untrusted connections.

2 days agoMEDIUM: http/hardening: reject forbidden payload on 1xx/204 responses
Willy Tarreau [Mon, 23 Nov 2026 12:39:03 +0000 (13:39 +0100)]
MEDIUM: http/hardening: reject forbidden payload on 1xx/204 responses

When a content-length greater than zero or a transfer-encoding header
are presented with responses that may not contain any body, the new
hardening rule "reject-forbidden-payload" will block them to limit the
risk of attacks (e.g. cache poisonning). It is enabled by default on
untrusted connections.

For h2 and h3 it's not easy to test. haproxy was used with an
http-request return action for this, along with a code modification
in http_parse_http_reply() to disable the 204+CL check.

2 days agoMEDIUM: http/hardening: default to rejecting untrusted duplicate C-L
Willy Tarreau [Mon, 23 Nov 2026 10:46:27 +0000 (11:46 +0100)]
MEDIUM: http/hardening: default to rejecting untrusted duplicate C-L

We're currently doing great efforts trying to detect abnormal
content-length headers and even normalize duplicates, but it's still
possible for upstream agents to be fooled by them (e.g. sum them) and
pass them, so let's add "reject-duplicate-content-length", a new
hardening option to reject them, and enable it by default on public-
facing connections since this is really not something that is seen
outside of attacks.

2 days agoMEDIUM: http/hardening: delete untrusted headers/trailers with underscore
Willy Tarreau [Mon, 23 Nov 2026 08:56:17 +0000 (09:56 +0100)]
MEDIUM: http/hardening: delete untrusted headers/trailers with underscore

No standard header/trailer name exists with underscores, and these are
sometimes converted to the same variable name as the ones with a dash by
some application frameworks or CGI/FCGI, causing confusion. Let's just
drop them by default from untrusted peers (we don't deny these requests
nor responses though).

2 days agoMINOR: http_ana: always drop the Expect header in HTTP/1.0
Willy Tarreau [Mon, 23 Nov 2026 08:47:23 +0000 (09:47 +0100)]
MINOR: http_ana: always drop the Expect header in HTTP/1.0

The Expect header wasn't specified in HTTP/1.0, and its only known
value 100-continue isn't usable there. Yet it continues to fool various
servers and reverse-proxies. Let's just drop it when seen in 1.0 requests
to be sure not to respond.

2 days agoMEDIUM: http_ana: control acceptance of 1xx status on HTTP/1.0
Willy Tarreau [Mon, 23 Nov 2026 07:53:30 +0000 (08:53 +0100)]
MEDIUM: http_ana: control acceptance of 1xx status on HTTP/1.0

HTTP/1.0 doesn't define status codes 1xx and these ones are not uniformly
handled across agents. These must never be emitted, neither by an 1.0
server nor to an 1.0 client, or there is a risk of smuggling. Let's
block them by default, and subject them to the "http-1.0-status-1xx"
response violation rule.

2 days agoMINOR: http: Add support for HTTP 411 status code
Willy Tarreau [Mon, 23 Nov 2026 14:46:22 +0000 (15:46 +0100)]
MINOR: http: Add support for HTTP 411 status code

411-Length-Required is now part of supported status codes that
can be defined as error files. The hash table defined in
http_get_status_idx() was updated accordingly (the factor 406 did
not change).

2 days agoDEV: phash: improve the output to permit an easier copy-paste
Willy Tarreau [Mon, 23 Nov 2026 14:42:14 +0000 (15:42 +0100)]
DEV: phash: improve the output to permit an easier copy-paste

The output had to be recopied manually. Let's print it as an array like
it is in the code so that it's now possible to simply copy-paste it
there and avoid mistakes.

3 days agoMINOR: mux-quic: remove error trace on transport failure
Amaury Denoyelle [Mon, 23 Nov 2026 15:55:11 +0000 (16:55 +0100)]
MINOR: mux-quic: remove error trace on transport failure

An error trace is reported by MUX-QUIC when the transport layer detects
a connection closure. However, most of the time this occurs because the
client has closed the connection after finishing its transfer via a
NO_ERROR code.

This termination is expected and should not be considered as an error.
For this reason, remove the trace from the MUX-QUIC layer.

3 days agoBUG/MEDIUM: mux-h2: reject non-101 2xx responses to Extended CONNECT
Olivier Houchard [Mon, 23 Nov 2026 15:13:02 +0000 (16:13 +0100)]
BUG/MEDIUM: mux-h2: reject non-101 2xx responses to Extended CONNECT

An Extended CONNECT (RFC8441) is converted to an upgrade request for an
H1 server, and a 101 response is converted to a 200, meaning that the
tunnel is established. But if the server ignores the upgrade and returns
a regular 2xx, it was forwarded as-is, so the client considered the
tunnel as established and took the payload for tunneled data.

Let's handle such a response as an error, as is already done for a 101
without Extended CONNECT.

This was introduced in 2.4 by commit efe2276a9 ("MEDIUM: mux_h2:
generate Extended CONNECT response") and must be backported to all
supported versions.

3 days agoMINOR: server: lookup defaults section on "from be:"
Amaury Denoyelle [Mon, 23 Nov 2026 13:22:54 +0000 (14:22 +0100)]
MINOR: server: lookup defaults section on "from be:"

This patch is similar to the previous one. As an alternative to a
backend name, "from be:" may now also reference a named defaults section
to reuse its unnamed default-server.

3 days agoMINOR: server: lookup defaults section on "from srv:"
Amaury Denoyelle [Mon, 23 Nov 2026 08:53:09 +0000 (09:53 +0100)]
MINOR: server: lookup defaults section on "from srv:"

When defining a server, notation 'from srv:<bename>/<srvname>' can be
specified to inherit from a server or default-server defined in another
backend instance.

Extend this to also look up in defaults sections. This is safe as
proxies and defaults sections cannot have the same name since 3.3.

Without this patch, a named default-server in a named defaults section
is unusable as it cannot be referenced by the existing syntax.

3 days agoMINOR: server: report incorrect usage of "from" keyword
Amaury Denoyelle [Mon, 23 Nov 2026 10:04:24 +0000 (11:04 +0100)]
MINOR: server: report incorrect usage of "from" keyword

Define a parser for the "from" server keyword. It always returns an
error reporting its invalid position as any "from" setting has already
been parsed during _srv_parse_from().

Also, this prevents a later keyword list from overriding this name.

3 days agoBUG/MINOR: qmux: prevent pacing BUG_ON() on send syscall zero return
Amaury Denoyelle [Tue, 17 Nov 2026 15:15:48 +0000 (16:15 +0100)]
BUG/MINOR: qmux: prevent pacing BUG_ON() on send syscall zero return

Previously, qcc_qmux_send_frames() would return 1 in case a send failed
on a transient error while nothing was emitted. However, this may
trigger a BUG_ON() in qcc_io_send() as this return value is reserved for
QUIC pacing support, not relevant with QMux.

Fix this by converting the return value to a negative value, which is
already used for fatal errors.

The caller is responsible for re-emitting the new the frame later. As
such, the prepared record is cleared from the send buffer to avoid a
duplicate emission on initial flush.

Note that this patch does not implement full support for QMux partial
emission if the send syscall accepts some but not all bytes, resulting
in a partially delivered frame. This must be implemented in a future
patch. Once this is the case, all code related to the handling of send
zero return can probably be removed.

This must be backported up to 3.4.

3 days agoCLEANUP: tcpcheck: Stop to export most of custom expect functions
Christopher Faulet [Mon, 23 Nov 2026 07:19:01 +0000 (08:19 +0100)]
CLEANUP: tcpcheck: Stop to export most of custom expect functions

The custom expect functions, for instance tcpcheck_ldap_expect_bindrsp(),
are only used by tcpcheck rules. No reason to export them. The only
exception is the one parsing agent-check response because the parsing of
this option is performed in check.c.

Note also tcpcheck_spop_expect_agenthello() was removed during SPOE
refactoring, so there is no function definition.

3 days agoREGTESTS: mysql-check: refresh the regtest for the auth switch support
Christopher Faulet [Fri, 20 Nov 2026 09:52:14 +0000 (10:52 +0100)]
REGTESTS: mysql-check: refresh the regtest for the auth switch support

The mock servers no longer expect a COM_QUIT command pipelined with
the handshake response for the post-80 and post-80-sha2 modes, and
new servers exercise an auth switch request, with a success and
failures, including a full authentication request and an access
denied error. Two servers also send an invalid auth switch request,
with an empty payload or a plugin name not terminated by a NUL byte,
to make sure the packet is validated before being handled.

3 days agoDOC: config: update mysql-check doc for the auth switch support
Christopher Faulet [Tue, 17 Nov 2026 14:29:05 +0000 (15:29 +0100)]
DOC: config: update mysql-check doc for the auth switch support

Document the behavior of the post-80 and post-80-sha2 modes when
the authentication plugin of the check user differs from the
announced one.

3 days agoMEDIUM: tcpcheck: handle MySQL AuthSwitchRequest in mysql-check post-80 modes
Christopher Faulet [Tue, 17 Nov 2026 14:29:00 +0000 (15:29 +0100)]
MEDIUM: tcpcheck: handle MySQL AuthSwitchRequest in mysql-check post-80 modes

With the post-80 and post-80-sha2 modes, when the authentication
plugin of the check user differs from the announced one, the server
replies to the handshake response with an AuthSwitchRequest. The
check now answers with an empty password for the requested plugin,
then concludes on the authentication result: an OK packet marks the
server as UP, an ERR packet as DOWN, and a full authentication
request fails cleanly as it requires the password.

The AuthSwitchRequest packet is validated before being handled: a
packet with an empty payload or with a plugin name not terminated by
a NUL byte is reported as an invalid response. Otherwise the plugin
name would be searched outside the packet bounds.

To do so, the COM_QUIT command is no longer pipelined right after
the handshake response. It is now sent once the authentication
result is known, packed with the auth switch reply when there is
one, so the session is cleanly closed in every case and no
connection error is recorded on the server. The legacy pre-41 and
post-41 modes keep the pipelined COM_QUIT, they cannot receive an
auth switch request.

3 days agoMINOR: tcpcheck: evaluate custom expect rules on empty response when allowed
Christopher Faulet [Tue, 17 Nov 2026 14:28:55 +0000 (15:28 +0100)]
MINOR: tcpcheck: evaluate custom expect rules on empty response when allowed

The custom expect functions are not evaluated when the response
buffer is empty. When the TCPCHK_EXPT_FL_ALLOW_EMPTY flag is set
on the rule, the function is now called with an empty buffer, on
the condition it properly handles this situation. It is useful
when the connection closure by the server is itself a valid
result.

3 days agoMINOR: tcpcheck: add TCPCHK_EXPT_FL_ALLOW_EMPTY flag on expect rules
Christopher Faulet [Tue, 17 Nov 2026 14:27:35 +0000 (15:27 +0100)]
MINOR: tcpcheck: add TCPCHK_EXPT_FL_ALLOW_EMPTY flag on expect rules

Custom expect functions are not evaluated when the response buffer is
empty. With the new TCPCHK_EXPT_FL_ALLOW_EMPTY flag, a custom expect
rule can be evaluated with an empty response, on the condition the
custom function properly handles this situation. It is useful when
the connection closure by the server is itself a valid result.

3 days agoMEDIUM: stconn: Forward kip hint right before the endpoint callback
Christopher Faulet [Fri, 20 Nov 2026 08:30:20 +0000 (09:30 +0100)]
MEDIUM: stconn: Forward kip hint right before the endpoint callback

sc_ep_fwd_kip_when_committed() forwards the <kip> hint of the producer to
the <kop> hint of the consumer, so the latter may use it as an optimization
(the H1 mux announcing a chunk covering the whole payload at once).

It is currently called at the entry of sc_conn_send() and sc_applet_send(),
and in task_run_applet() before checking the applet was not shut. Thus the
hint may be forwarded while no endpoint callback is invoked, or while the
applet is not called at all. This leaves a pending guarantee on the
consumer side for data that may never be emitted by this call.

Move the call right before the callbacks which may consume <kop>
(resume_fastfwd() and snd_buf() for a connection, appctx_snd_buf() for an
applet), and inside the applet shutdown check, so the hint is forwarded
only when a callback is really invoked. resume_fastfwd() does not use <kop>
for now, but it is not the stconn's business to know which callback consumes
it. The recv side already works this way, before fastfwd() and
appctx_fastfwd().

This is not a fix and there is nothing to backport.

3 days agoBUG/MEDIUM: mux-h1: never forward more data than announced in a chunk
Christopher Faulet [Thu, 19 Nov 2026 08:05:00 +0000 (09:05 +0100)]
BUG/MEDIUM: mux-h1: never forward more data than announced in a chunk

When a chunked message is sent and a new chunk is started in the zero-copy
path of h1_make_data(), the chunk size is taken from the <kop> hint of the
sedesc when it is set:

    h1m->curr_len = (h1s->sd->kop ? h1s->sd->kop : count);

<kop> is the known output payload length, and by contract it is a minimal
guarantee: at least this size will be forwarded. When it is set, the H1 mux
announces it as the size of the chunk and consumes it. 0 means the output
payload length is unknown, and in this case only the size of the data block
is announced.

But nothing checked that the data sent with the chunk did not exceed the
announced size: h1m->curr_len was blindly decremented, possibly wrapping,
and the remaining bytes of the block were emitted without any chunk framing.

Such a violation could be observed when a data filter was used on the
request, before the previous patch fixed its root: the <kip> hint was
forwarded to <kop> on a stream not committed to forward its data, and a
stale value could then be announced for a data block, possibly smaller than
the block itself.

The copy path already reported an error for messages with a content-length
when more data than announced was met. The same check is now done in the
zero-copy path, for chunked messages: report an error and close the stream
instead of silently emitting an unframed payload. This is a guard for extra
safety, on top of the previous patch which fixes the issue at its root, in
the stream connectors.

Both patches must be backported as far as 3.3. On the stable branches, this
one must be applied on top of the other one, otherwise valid messages may be
rejected when a data filter alters the payload size and a stale <kip> hint
was moved to <kop>.

3 days agoBUG/MEDIUM: stconn: Only forward kip hint on streams committed to forward data
Christopher Faulet [Thu, 19 Nov 2026 08:00:00 +0000 (09:00 +0100)]
BUG/MEDIUM: stconn: Only forward kip hint on streams committed to forward data

The <kip> hint of a sedesc is the payload length the producer endpoint
estimates it will emit. It is forwarded to the <kop> hint of the opposite
sedesc by sc_ep_fwd_kip(), so the consumer endpoint can use it as an
optimization, for instance the H1 mux to announce a chunk size covering the
whole payload at once.

But <kip> could be set by the producer on the data it demultiplexes, before
the app layer has a chance to see it. In particular, when data filters are
registered on the channel, flt_http_payload() resets <kip> after each pass,
because the filters may alter or drop any part of the payload. But in the
meantime, an I/O callback may already have moved the hint to the opposite
side: the consumer then uses a stale <kop> value, and the data it emits may
not match what this value announces.

This is how the H1 mux could be led to announce a chunk smaller than the
data sent with it, and to emit the remaining bytes without any chunk
framing, making an HTTP/1 server process a part of the request payload as
another request (request smuggling).

The root of the issue is that <kip>/<kop> are hints on data which were
not evaluated by the app layer yet, but they may be consumed as if they
were. <kop> is a minimal guarantee on the output payload: when it is
set, at least this size will be forwarded. It is only safe to feed it
with <kip> once the app layer committed to forward the data as-is.

This patch introduced a safe version of sc_ep_fwd_kip(),
sc_ep_fwd_kip_when_committed(), which only forwards the hint when the
producer channel is configured to forward data indefinitely (to_forward ==
CHN_INFINITE_FORWARD). This is the only case where the app layer committed
to forward everything, without any alteration: http_wait_request_body() and
http_wait_for_response_body() set the infinite forwarding only when no data
filter is registered on the channel. Otherwise <kop> stays null and the
consumer endpoints fall back to their conservative behavior (the H1 mux
announces the size of the data it emits).

When the app layer is not committed yet, <kip> is reset instead of being
kept for later. Until the infinite forwarding is reached, data may be
forwarded and emitted by the consumer with a null <kop>, while <kip> still
accounts for them, because it is only decremented when forwarded. Moving
it later would then set <kop> higher than the remaining payload, and the
H1 mux would announce a chunk bigger than the data left to send. Resetting
it keeps <kop> conservative: lower than the remaining payload, never
higher.

Thanks to Hyunho Seo for the issue analysis.

This patch must be backported as far as 3.3.

3 days agoBUG/MEDIUM: applets: do not wake up applets before the end of the request analysis
Christopher Faulet [Thu, 19 Nov 2026 18:10:00 +0000 (19:10 +0100)]
BUG/MEDIUM: applets: do not wake up applets before the end of the request analysis

The applet is woken up as soon as it is created by sc_applet_create(). But
the request analysis is not over at this point and it may still be paused,
typically by a "http-request wait-for-body" rule, while the applet is
already attached to the back stream connector (the cache after a
cache-use hit, for instance). Thus, the applet could start to consume the
request and to produce its response before the end of the request
analysis, and the response analysers were evaluated in the same time. It
is unexpected and it could lead to weird issues.

To fix the issue, the way the applets are created is changed.
sc_applet_create() no longer schedules the applet and it no longer
switches the stream connector to the ready state. The applet remains in
SC_ST_INI state, in a dormant state, and the request analysis can
continue, undisturbed. The applet is woken up by back_handle_st_req(),
when the request analysis is over and the stream connector switches from
SC_ST_INI to SC_ST_REQ and then to SC_ST_RDY.

Thus, process_use_service() was reviewed accordingly. Because the
use-service action is terminal and it never yields, there is no re-entry
in this function, so the re-entry branch was removed. And the applet is
not woken up by the action anymore. It will be done by
back_handle_st_req(). Note that a re-entry would now fail in
sc_applet_create(), because the SE_FL_DETACHED flag is cleared once an
applet is attached.

Note this design change reverts, in intent, the commit a33ff7a8a
("BUG/MEDIUM: conn-stream: Set back CS to RDY state when the appctx is
created"). Here, the stream connector is set to the ready state when the
applet is woken up, not when the appctx is created, so the ambiguity
discussed in this commit remains solved: there is no target installed on
a stream connector in SC_ST_INI state, and the stream connector is
switched to SC_ST_RDY state before the applet starts to work.

This patch could be backported to all supported versions. But because it is
a design change, it is probably better to not backport it lower than the
3.2, and only after a period of observation. It relies on "BUG/MEDIUM:
stconn: Do not install an applet on a busy stream connector"

3 days agoBUG/MEDIUM: stconn: Do not install an applet on a busy stream connector
Christopher Faulet [Thu, 19 Nov 2026 18:00:00 +0000 (19:00 +0100)]
BUG/MEDIUM: stconn: Do not install an applet on a busy stream connector

It is possible to install an applet on a stream connector with an applet
already attached. This could happen with a "http-request cache-use" rule
followed by a matching "http-request use-service" rule, when the
cache-use rule hits. The use-service rule installs a second applet on the
same stream connector, replacing the cache one, which is leaked with its
retained cache row. The commit a72de1022 ("BUG/MEDIUM: cache: do not
create a second applet when two cache-use rules hit") only fixed the case
of two cache-use rules. The use-service rules are still vulnerable.

To fix the issue, sc_applet_create() now checks the SE_FL_DETACHED flag
and fails if it is not set. This flag is set when the stream connector is
created and it is cleared when an endpoint is attached, a mux or an
applet, and it is set again by sc_reset_endp() when the endpoint is
reset, to be able to retry a connection. Thus, it is not possible to
install an applet on a stream connector with an applet already attached
anymore.

This patch should be backported to all supported versions. The commit
a72de1022 is not present in the stable branches and the same weakness
exists there since sc_applet_create() was introduced in 2.6.

3 days agoDOC: htx: add the NOOP block to the HTX API documentation
Christopher Faulet [Mon, 23 Nov 2026 13:23:11 +0000 (14:23 +0100)]
DOC: htx: add the NOOP block to the HTX API documentation

Update the htx-api internals documentation for the HTX_BLK_NOOP block
introduced by the "MINOR: htx: Add a noop block to carry the EOM flag on an
empty message" commit:

  - Add the no-op block to the marker kinds, the supported types list and
    the typical composition of an HTX message.

  - Document that a NOOP block may carry the EOM flag and that htx_set_eom()
    now relies on it, and no longer on an EOT block, to report the end of
    an empty message.

  - Document that an EOT block without the EOM flag is a valid state: the
    end of the trailers was reached but the message is not ended, more data
    may follow. Consumers must check the EOM flag, not the block type.

  - Mention NOOP for htx_add_endof() and the new htx_add_noop() shortcut,
    for htx_get_blk_value() which returns an empty string for it, and fix
    the htx_skip_msg_payload() description which may now add a NOOP block
    when the message becomes empty.