]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: jwt: Make invalid static JWT algorithms an error in `jwt_verify` converter
authorTim Duesterhus <tim@bastelstu.be>
Fri, 29 Oct 2021 16:06:55 +0000 (18:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 3 Nov 2021 10:15:32 +0000 (11:15 +0100)
It is not useful to start a configuration where an invalid static string is
provided as the JWT algorithm. Better make the administrator aware of the
suspected typo by failing to start.

src/sample.c

index 9200ca30346b6e001b06bc3e4e379d7bf7625b1a..5abf4712aa3c91c1709f870559207980cd19c4f5 100644 (file)
@@ -3522,14 +3522,14 @@ static int sample_conv_jwt_verify_check(struct arg *args, struct sample_conv *co
 
                switch(alg) {
                case JWT_ALG_DEFAULT:
-                       memprintf(err, "unknown JWT algorithm : %s", *err);
-                       break;
+                       memprintf(err, "unknown JWT algorithm: %s", args[0].data.str.area);
+                       return 0;
 
                case JWS_ALG_PS256:
                case JWS_ALG_PS384:
                case JWS_ALG_PS512:
                        memprintf(err, "RSASSA-PSS JWS signing not managed yet");
-                       break;
+                       return 0;
 
                default:
                        break;