]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: acme: don't delete a NULL token from the map
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 6 Aug 2026 07:29:07 +0000 (09:29 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 7 Aug 2026 10:02:53 +0000 (10:02 +0000)
When an ACME task ends, acme_del_acme_ctx_map() walks the list of
authorizations and removes each challenge token from the configured map.
But an authorization is created with only its URL set, and its token is
only filled in once the CA's answer for that authorization has been
successfully parsed. The "dns-persist-01" challenge type never sets one at
all. Every termination path of the task goes through that cleanup, so a
NULL token was passed to pat_ref_delete(), which compares it against the
keys of the reference and dereferences it.

For users this means that an ACME configuration using a "map" crashes the
worker whenever the certificate renewal fails early, for instance when the
CA is unreachable and the retries are exhausted, or when it answers
something unexpected. The very component that is supposed to keep the
service running then takes it down.

Let's simply ignore authorizations without a token, they have nothing
registered in the map anyway.

This was introduced in 3.2 by commit 5555926fd ("MEDIUM: acme: use a map
to store tokens and thumbprints"). It must be backported to 3.2.

Reported-by: Claude (ANT-2026-YXC5HJZS)
src/acme.c

index 6d07eb74450badf053f3f125cbf4d11c90867397..367fa12b1c674d40853a695ca1ebc1a17154d2cf 100644 (file)
@@ -1272,8 +1272,8 @@ static void acme_del_challenge_map(const char *map, const char *challenge)
 {
        struct pat_ref *ref;
 
-       /* when no map configured, return without error */
-       if (!map)
+       /* no map configured, or no challenge token was retrieved */
+       if (!map || !challenge)
                return;
 
        ref = pat_ref_lookup(map);