]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: jwt: Add refcount to jwt tree entry
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Thu, 26 Nov 2026 10:11:55 +0000 (11:11 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 26 Nov 2026 13:14:09 +0000 (14:14 +0100)
commita3aa2e20ac6af695faa85fce0edf878fa67cbd45
treea031f6265f02cf3516b5b2485fb5fd6bbf9960ce
parent7dcc9681fe930fce66c09b8cf695b9d54546f533
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.
include/haproxy/jwt-t.h
include/haproxy/jwt.h
reg-tests/jwt/jws_verify.vtc
src/jwt.c
src/ssl_ckch.c