From: Remi Tricot-Le Breton Date: Fri, 20 Nov 2026 10:08:46 +0000 (+0100) Subject: MINOR: jwt: Deprecate jwt_verify converter X-Git-Url: https://git.kaiwu.me/http/%22../static/gitweb.js?a=commitdiff_plain;h=0be3050adfb75a886917655de644bd4c09b5e841;p=haproxy.git MINOR: jwt: Deprecate jwt_verify converter The 'jwt_verify' converter was built with the idea of being easy to use for all JWT tokens and its second parameter needied to be interpreted totally differently depending on the first parameter (HMAC vs pubkey path). This comes with a potential security risk if a user did not check the algorithm type before calling the converter. If an HMAC-signed token was tested in a jwt_verify call that provided a certificate as second parameter, an attacker could try to guess the certificate path and forge HMAC tokens that validate against the certificate path. In order to get rid of this potential risk, a new jwt_verify_secret converter was introduced, and paired with the already existing jwt_verify_cert one, we can fully get rid of this risk since no parameter gets treated differently based off client-provided information. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 4b63abbca..0170ff7ac 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -23389,7 +23389,10 @@ jwt_payload_query([[,]]) Please note that this converter is only available when HAProxy has been compiled with USE_OPENSSL. -jwt_verify(,) +jwt_verify(,) (deprecated) + + This converter is deprecated, use 'jwt_verify_secret' or 'jwt_verify_cert' + instead. Performs a signature verification for the JSON Web Token (JWT) given in input by using the algorithm and the parameter. diff --git a/reg-tests/jwt/jws_verify.vtc b/reg-tests/jwt/jws_verify.vtc index f1174c117..8b508c857 100644 --- a/reg-tests/jwt/jws_verify.vtc +++ b/reg-tests/jwt/jws_verify.vtc @@ -33,6 +33,7 @@ haproxy h1 -conf { tune.ssl.capture-buffer-size 1 stats socket "${tmpdir}/h1/stats" level admin jwt.allow_none_alg + expose-deprecated-directives defaults mode http diff --git a/src/sample.c b/src/sample.c index 544816603..96ace8f5d 100644 --- a/src/sample.c +++ b/src/sample.c @@ -5268,6 +5268,10 @@ static int sample_conv_jwt_verify_check(struct arg *args, struct sample_conv *co expect_cert = 1; else if (strcmp(conv->kw, "jwt_verify_secret") == 0) expect_secret = 1; + else if (!deprecated_directives_allowed){ + ha_warning("parsing [%s:%d]: 'jwt_verify' converter is deprecated, " + "use 'jwt_verify_secret' or 'jwt_verify_cert' instead.\n", file, line); + } if (args[0].type == ARGT_STR) { alg = jwt_parse_alg(args[0].data.str.area, args[0].data.str.data);