[fix][sec] Upgrade to async-http-client 2.14.5 to address CVE-2026-40490#25546
[fix][sec] Upgrade to async-http-client 2.14.5 to address CVE-2026-40490#25546nodece merged 4 commits intoapache:masterfrom
Conversation
|
I have a question. This vulnerability allowed async-http-client to send the Authorization header to the redirected URL without removing it when In Pulsar, HTTP redirects from one broker to another are common, and the domain of the URL changes during this process. In addition, the following authentication plugins use the Authorization header: |
@massakam good question. I'll address this. Claude made this analysis based on your question:
|
|
@lhotari Thank you for your reply!
I understand that this upgrade will not cause regressions. On the other hand, this behavior is not much different from async-http-client before the vulnerability was fixed, so it may be an issue that Pulsar should consider addressing in the future.
This looks like it will block this upgrade. Are you planning to modify pulser-client in this pull request? |
…rization async-http-client 2.14.5 (CVE-2026-40490 fix) strips the Authorization header on cross-origin redirects when its built-in follow-redirect is enabled. Pulsar's HTTP lookup routinely 307-redirects to another broker's httpUrl/httpUrlTls, which is a different host:port from the client's service URL. After the AHC upgrade, token/basic/OAuth2-authenticated HTTP lookups would fail with 401. Disable AHC's follow-redirect in HttpClient and drive the redirect loop in pulsar-client, re-invoking authentication.newRequestHeader(...) per hop so Authorization is applied to the redirect target. Mirrors the manual-redirect pattern already used by pulsar-client-admin's AsyncHttpConnector. Adds WireMock-based cross-origin redirect tests for HttpClient, HttpLookupService, and AsyncHttpConnector (the last locks in the admin client's existing safe behavior).
yes |
|
@massakam PTAL |
…lient The top-level catch in HttpClient.get logged the opaque marker "PulsarClientImpl". Replace it with a descriptive message so log aggregations actually tell you what went wrong.
(apache#25546) (cherry picked from commit a1613bc) (cherry picked from commit bc81102)
(apache#25546) (cherry picked from commit a1613bc) (cherry picked from commit cfa8192)
Motivation
async-http-client 2.12.4 contains GHSA-cmxv-58fp-fm3g / CVE-2026-40490.
The CVE fix in async-http-client 2.14.5 strips the
AuthorizationandProxy-Authorizationheaders on cross-origin redirects (different scheme/host/port) when AHC's built-in follow-redirect is enabled. There is no opt-out.Impact on Pulsar:
pulsar-client-admin: safe.AsyncHttpConnectoralready setssetFollowRedirect(false)and runs a manual redirect loop, so AHC's new stripping never runs. No test previously guarded this invariant, though — a future regression to built-in follow-redirect would silently break cross-broker admin calls.pulsar-clientHttpLookupService→HttpClient: broken.HttpClientsetsetFollowRedirect(true)and only invokedauthentication.newRequestHeader(...)once on the initial request. After the AHC upgrade,HttpLookupService.getBroker(...)andgetPartitionedTopicMetadata(...)would receive 401 on any cross-broker 307 redirect (Pulsar'sTopicLookupBaseroutinely redirects to a different broker'shttpUrl/httpUrlTls). AffectsAuthenticationToken,AuthenticationBasic,AuthenticationOAuth2,AuthenticationAthenz,AuthenticationSasl, and any custom plugin that sets theAuthorizationheader.Modifications
async-http-clientfrom 2.12.4 to 2.14.5 (note: skips 2.12.5 — explanation).pulsar-clientHttpClient: disable AHC's built-in follow-redirect (setFollowRedirect(false)) and drive the redirect loop in Pulsar code. The newexecuteGet(...)/handleRedirect(...)re-invokesauthentication.getAuthData(...)+authentication.newRequestHeader(...)per hop, so theAuthorizationheader (and per-hop auth data — useful for OAuth2 / SASL) is applied to the redirect target. Handles 301/302/303/307/308, bounded byconf.getMaxLookupRedirects(). Mirrors the pattern already used bypulsar-client-admin'sAsyncHttpConnector."PulsarClientImpl"setup-failure log inHttpClient.get(...)with a descriptive message.Verifying this change
This change added tests and can be verified as follows:
HttpClientTest.testCrossOriginRedirectCarriesAuthorizationHeader(new,pulsar-client) — two WireMock servers on different ports; serverA returns 307 to serverB; serverB requiresAuthorization: Bearer test-token. Fails without the fix (401 from serverB — AHC 2.14.5 stripped the header), passes with the fix.HttpLookupServiceTest.testGetBrokerFollowsCrossOriginRedirect(new,pulsar-client) — end-to-endHttpLookupService.getBroker(TopicName)against the same cross-origin setup.AsyncHttpConnectorTest.testAuthorizationHeaderOnCrossOriginRedirect(new,pulsar-client-admin) — locks in that the admin connector continues to forwardAuthorizationacross cross-origin redirects. Passes without any admin code change — guards a future regression (e.g., flippingsetFollowRedirectback totrue).Added
wiremockas a test dependency inpulsar-client(already available in the version catalog and in use bypulsar-client-admin).Does this pull request potentially affect one of the following parts:
async-http-client2.12.4 → 2.14.5;wiremockadded topulsar-clienttest scope.