]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: http-fetch: fix the space check of http_auth_bearer(<hdr>)
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 04:38:06 +0000 (04:38 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 12:05:26 +0000 (14:05 +0200)
commit1afc7ca3ad95638080de70538ed75c3bf55f98e6
tree0051044a5490c05ac35bb525729003603278c431
parent39e4fe6e33e599cbc8fa700a6218a5fe6eb7ab47
BUG/MINOR: http-fetch: fix the space check of http_auth_bearer(<hdr>)

When http_auth_bearer() was called with a custom header name, a test was
performed to know if the value contained a space after the scheme, by
comparing the length of the scheme with the length of the header value.

But istsplit() had already advanced <ctx.value> past the scheme and the
space at this point, so the comparison was made with the length of the token
instead:

  - a token of exactly 6 characters, the length of "Bearer", was reported as
    a mismatch, e.g. "Bearer abcdef";

  - a lone "Bearer" without any space was accepted and returned an empty
    token.

Let's compare with the length of the value before it is split. The reg-test
is extended with these two cases.

This should be backported to all supported versions.
reg-tests/sample_fetches/http_auth_bearer.vtc
src/http_fetch.c