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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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").
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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").
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.
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:
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.
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.
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.
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.
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().
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):
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.
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).
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.
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.
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.
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 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.
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.
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.
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).
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.
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.
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.
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).
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:
<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>.
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.
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"
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.
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.
MINOR: htx: Add a noop block to carry the EOM flag on an empty message
A new HTX block type, HTX_BLK_NOOP, is added. It has the same traits as
the EOH and EOT blocks: a size of 1, to be able to wake the endpoint up
when it is emitted alone, but nothing is sent when a consumer encounters
it. It may carry the EOM flag and it is allowed anywhere in the message.
It is used by htx_set_eom() to report the end of an empty message: the
EOM flag was previously carried by an EOT block in this case, which was
misleading, an end-of-trailers block carrying no data. As a consequence,
an EOT block without the EOM flag is now a valid state, the message is
simply not ended. This must be handled by all the consumers, especially
the muxes:
- The H1 mux skips the NOOP blocks and, when one carries the EOM flag,
it reports the end of the message exactly like a last DATA block. An
EOT block without the EOM flag still ends the message framing, as
before: on the wire, the trailers terminate a chunked message, there
is nothing to add after them.
- The H2 mux skips the NOOP blocks and, when one carries the EOM flag,
it emits an empty DATA frame with the END_STREAM flag and closes the
stream. For a trailers frame, the END_STREAM flag is now only set
when the EOT block carries the EOM flag, and the stream is only
closed in this case. An EOT block without the EOM flag means the
message is not finished and more data may follow.
- The H3 mux skips the NOOP blocks and, when one carries the EOM flag,
it sets the fin flag on the stream. Like the H2 mux, the fin flag is
only reported for an EOT block carrying the EOM flag.
- The FCGI mux skips the NOOP blocks and, when one carries the EOM
flag, it emits an empty STDIN record to signal the end of the request.
All the other consumers, the filters, the applets, the sample fetches and
the health-checks, were audited: they either ignore the unknown block
types or stop their walk on the block carrying the EOM flag, so a NOOP
block is properly handled by all of them.
There is no need to backport this patch, it is an enabler for future uses.
MINOR: filters: Register a dedicated trace source for the filters
The filters were traced using the stream trace source, with the
STRM_EV_FLT_ANA and STRM_EV_FLT_ERR events. It was convenient but it
mixed the filters with the stream analysers, and the events were not
detailed enough to know which filter callback was called, nor on which
channel.
Now a dedicated "filter" trace source is registered. The first argument is
always the stream, the second one is the filter instance and the third one
is the channel, so that the lock-on may be performed on a specific filter.
The events are split by callback: start_ana, pre_ana, post_ana, end_ana,
http_hdrs, http_payload, http_end, http_reset, http_reply, tcp_payload and
xfer_data. Two other events are reported when a filter is attached to or
detached from a stream. The wait and err events are reported when the
filter analysis is paused waiting for data or when it fails.
The decoding function reports the stream and the channel states, the
filter id and its flags, the filter offsets, and the channels' buffers
when the verbosity is high enough. This way it is possible to follow a
filter instance through the analysis of a request or a response, which was
not possible with the stream trace source alone.
The STRM_EV_FLT_ANA and STRM_EV_FLT_ERR events are removed, along with
their entries in the stream trace source, since they are not used
anymore.
A client request can make the FastCGI path copy exactly fill its
scratch buffer. b_tail() then wraps to the start, so subtracting the
path length points before the buffer. URL decoding reads and writes
there instead of reading the copied path.
Require one free byte for ist0()'s terminator. The request then
follows the existing error path; ordinary paths keep working.
Commit a01ba66bc2 rejected oversized copies but missed exact fits.
This should be backported to affected stable branches.
Signed-off-by: Kelly Kane <kelly@hawknetworks.com>
BUG/MEDIUM: acme: take the resolvers lock when linking/unlinking DNS requesters
The dns-01 pre-check links an ACME requester to a resolution in
acme_rslv_start() and unlinks it in acme_rslv_free(), both called from
the ACME task, which runs on any thread. But resolv_link_resolution() and
resolv_unlink_resolution() manipulate the resolvers' resolution lists and
the resolutions' requester lists, which are also manipulated by the
resolvers task and the response handlers on the resolvers' thread under
resolvers->lock. Other requesters (do-resolve in streams, stream_free(),
CLI actions on servers) always take this lock around these calls, but
the ACME code never does.
Among the possible consequences, the requester callbacks are called on
the resolvers' thread while it iterates over the resolution's requesters
under the lock. The last callback wakes the ACME task up, which may then
immediately call acme_rslv_free() on another thread and unlink the last
requester, which aborts and frees the resolution in leave_resolver_code(),
while the resolvers' thread continues to use it (resolv_reset_resolution(),
LIST_DEL_INIT() etc). Concurrent insertions into the resolutions lists
with process_resolvers() may also corrupt them.
This requires an ACME dns-01 challenge with a multi-threaded process and
was only found by code review: there is currently no way to test ACME
here, but the rules are the same as for all other requesters.
Let's take the lock around the link+trigger and the unlink operations.
This was introduced in 3.4 with commit 631fd5f99 ("MEDIUM: acme: add dns-01
DNS propagation pre-check"), so this must be backported to 3.4.
Willy Tarreau [Sat, 21 Nov 2026 08:04:40 +0000 (09:04 +0100)]
CLEANUP: pattern: don't even run string-based matches on empty strings
None of our matching patterns supports matching an empty string, so let's
just not even try to call them for empty strings. This may even speed up
suboptimal configs that unconditionally search for certain things in empty
fields.
Willy Tarreau [Sat, 21 Nov 2026 07:59:56 +0000 (08:59 +0100)]
BUG/MEDIUM: pattern: check for non-empty string before matching regexes
Zübeyir Eser reported in github issue #3602 that passing req.body to the
default regex engine crashes when there is no body. This is because the
body returns an empty sample while the default regex engine demands at
least one byte available to write a trailing zero.
Let's make sure that regex matches don't even run when subject to empty
strings.
Willy Tarreau [Fri, 20 Nov 2026 18:23:26 +0000 (19:23 +0100)]
MEDIUM: config: emit warnings when changing bufsize after other sections
Long ago we emitted a diag when a global section is placed after some
non-global sections, but that's not sufficient because it's even possible
to change tune.bufsize (even shrink it) and face problems such as return
directives or errorfiles loaded with a larger value not being able to be
delivered.
Let's now emit warnings when the value changes, explaining the risks,
discourage from doing so, and do that as well for tune.maxrewrite and
tune.http.maxhdr, which also impacts the ability to build HTTP replies
on the fly.
BUG/MINOR: payload: distcc_body must not sample unreceived buffer bytes
When the declared body of a distcc token is longer than the data actually
received but still fits within the channel's receive limit,
smp_fetch_distcc_body() truncates the sample to channel_recv_limit() instead
of ci_data(). The sample then covers a range of the buffer that has not been
filled by the current connection, exposing stale bytes left by a previous
connection using the same pooled buffer, e.g. via ACLs, set-var, log-format
or header insertion.
In addition, the incomplete-body check mixed reference frames: ofs is
relative to the input head, but was compared against ci_head() - b_orig() +
ci_data(), which is only equivalent when the input head sits at the buffer
origin. With bytes already forwarded, a body extending past the received
data could be considered complete.
Both issues are fixed by comparing and truncating against ci_data(), the
amount of input data actually received, and by always setting
SMP_F_MAY_CHANGE on truncated bodies so the rules are re-evaluated once more
data arrives.
This patch should fix the issue #3583. It must be backported to all
supported versions.
BUG/MINOR: quic: fix uninitialized read of pkt->rs.delivered in ACK processing (BBR)
In qc_notify_cc_of_newly_acked_pkts() the ->rs.delivered field of a TX
packet is unconditionally read for each newly acknowledged packet. But
->rs is filled in at TX time by quic_cc_drs_on_pkt_sent() (called from
drs_on_transmit() under QUIC_FL_TX_PACKET_ACK_ELICITING guard) for
ack-eliciting packets only. For a non ack-eliciting packet, e.g. a pure
ACK packet, which can be acknowledged by a peer, ->rs has never been
written and this read returns an indeterminate value.
This value is consumed by quic_cc_drs_on_ack_recv() and on_ack_rcvd()
which may corrupt the delivery rate sampling round counting
(drs->round_count, drs->next_round_delivered): a stale value from a
previously recycled packet freezes the round detection, a null one
spuriously increments round_count. Only BBR is affected: cubic neither
provides get_drs() nor on_ack_rcvd().
Fix this by reading ->rs.delivered for ack-eliciting packets only, as
already done for the call to quic_cc_drs_update_rate_sample() just
below, and for on_pkt_lost() in quic_loss.c. Also document in
quic_tx_packet_init() that ->rs is deliberately left uninitialized and
must never be read for a non ack-eliciting packet.
Thank you to @brhenc for having reported this bug in GH #3587.
This bug was introduced by 44af88d85 ("MINOR: quic: RX part
modifications to support BBR") with the delivery rate sampling support.
This must be backported up to v3.2.
BUG/MINOR: lua: channel: append() must insert data at the end, not at the start
hlua_channel_append() inserts the string at the offset of the start of the
input data, like hlua_channel_prepend() does, instead of after the existing
input data. The offset+len expression is computed and passed through
hlua_channel_filter() but never used. The function is otherwise identical to
hlua_channel_prepend(), it seems to be a copy-paste mistake when the
filter-aware insert path was introduced; hlua_http_msg_append() correctly
inserts at offset+len for the same operation.
As a result, Channel.append() behaved exactly like Channel.prepend(),
placing the string in front of the channel's input data instead of at its
end, in contradiction with its documentation ("Same as
Channel.insert(channel, string, channel:input())").
This patch should fix the issue #3598. It must be backported to all
supported versions.
BUG/MINOR: vars: fix missing string termination in get var on too long values
vars_parse_cli_get_var() builds the output for the CLI's "get var" in the
shared trash chunk using b_putchr(), which silently drops bytes once the
buffer is full. For a value long enough to exhaust trash mid-loop, the
trailing '>' and the terminating NUL were dropped, leaving trash.area
without any NUL within its bounds. cli_msg() only stores the pointer and the
string is later read with ist() (i.e. strlen) in cli_output_msg(), reading
past the buffer.
Now the loop stops before the last byte, and the terminating NUL is always
written within bounds, truncating the output if needed.
This patch should fix the issue #3592. It could be backported to all
supported versions.
BUG/MINOR: tcpcheck: fix out-of-bounds read on the MySQL server version
On success, the MySQL health-check stores the server version, read at offset
5 of the received buffer, as the check description. The version is a
NUL-terminated string, but nothing guarantees the string is terminated,
neither inside the received data nor past its end. And the version pointer
is directly passed to set_server_check_status(), which copies it with
strncpy() up to 127 bytes, stopping at the first NUL byte. With a
non-compliant server sending a handshake with an unterminated version and no
NUL byte in the rest of the received data, the copy reads past the received
data, into the remaining content of the buffer chunk, and the stale bytes
are disclosed in the check status, visible in the logs, the stats page and
'show servers state'.
To fix it, the version is bounded to the received data before being copied
into the check status, like the plugin name of an auth switch request. This
is a rework of the out-of-bounds reads fixed by 3bbfc3bd7 ('BUG/MINOR:
tcpcheck: fix out-of-bounds reads on short MySQL error packets'), which
covered the error packets but not the success path.
This is a read past the received data, so it requires a non-compliant
server, which is out of the threat model (servers are trusted). Thus there
is no security impact here, only a potential information leak in the check
status.
This patch should fix the issue #3596. It should be backported to all
supported versions.
Olivier Houchard [Fri, 20 Nov 2026 14:33:44 +0000 (15:33 +0100)]
BUG/MEDIUM: mux-spop: let the buffer callback allocate despite the queue
spop_buf_available() is called by offer_buffers() while the spop_conn is
still in the buffer wait queue. Since commit d1eb48a12 ("MEDIUM: dynbuf:
refrain from offering a buffer if more critical ones are waiting"),
b_alloc() refuses to allocate when the queue of the same or of a more
critical level is not empty, unless DB_F_NOQUEUE is passed. As the spop_conn
is queued with DB_MUX_RX, the demux buffer allocation always fails from
the callback, and the connection remains blocked until it times out.
This was reproduced by faking a failed demux buffer allocation when
receiving the agent's reply: the SPOE processing times out.
Let's pass DB_F_NOQUEUE to the allocations made from the callback, as
was done for mux-h2 in commit d7192a667 ("BUG/MEDIUM: mux-h2: permit the
buffer callback to allocate despite the queue").
The issue comes from the commit above, and mux-spop is affected since
it was introduced in 3.1. This must be backported to 3.1.
Olivier Houchard [Fri, 20 Nov 2026 14:33:44 +0000 (15:33 +0100)]
BUG/MEDIUM: mux-fcgi: let the buffer callback allocate despite the queue
fcgi_buf_available() is called by offer_buffers() while the fconn is
still in the buffer wait queue. Since commit d1eb48a12 ("MEDIUM: dynbuf:
refrain from offering a buffer if more critical ones are waiting"),
b_alloc() refuses to allocate when the queue of the same or of a more
critical level is not empty, unless DB_F_NOQUEUE is passed. As the fconn
is queued with DB_MUX_RX, the demux buffer allocation always fails from
the callback, and the connection remains blocked until it times out.
This was reproduced by faking a failed demux buffer allocation when
receiving the response: the request ends with a 504.
Let's pass DB_F_NOQUEUE to the allocations made from the callback, as
was done for mux-h2 in commit d7192a667 ("BUG/MEDIUM: mux-h2: permit the
buffer callback to allocate despite the queue").
This was introduced in 3.0 by the commit above and must be backported
to 3.0.
Olivier Houchard [Fri, 20 Nov 2026 13:29:45 +0000 (14:29 +0100)]
BUG/MEDIUM: mux-h2: don't stall on a failed rxbuf alloc without stream
When h2c_dec_hdrs() fails to allocate the temporary buffer used to
decode the HEADERS frame of a new request, it sets H2_CF_DEM_SALLOC and
the connection is queued in the buffer wait list. But h2_buf_available()
only serves H2_CF_DEM_SALLOC for a stream which has a stream connector,
which is not the case yet, so it never succeeds: the demux remains
blocked and the request is not processed until the connection times
out. This can be reproduced by faking a failed allocation there on the
first request of a connection.
There is no buffer the callback could allocate in this case, so let's
clear the flag and restart the demux, which will retry by itself. Since
b_alloc() refuses to allocate when other entries are queued, the retry
would be queued again and the offered buffer would be lost for
everyone, so a new flag H2_CF_DEM_MAYALLOC is set to let the next
h2_get_buf() allocate with DB_F_NOQUEUE, as mux-h1 does with
H1C_F_IN_MAYALLOC.
This was introduced in 2.0 by commit 5c8cafae3 ("MEDIUM: mux-h2: decode
HEADERS frames before allocating the stream"). It must be backported to
all supported versions. Before 3.0 there is no DB_F_NOQUEUE and the new
flag is not needed, clearing H2_CF_DEM_SALLOC and restarting the demux
is enough.