The vulnerability exists in the @hapi/wreck library's handling of HTTP redirects. Specifically, when a request that includes a Proxy-Authorization header is redirected to a different hostname, the library failed to strip this header before following the redirect. This could lead to the exposure of sensitive proxy credentials to a third-party server.
The patch was identified in commit a5b6fac9c684621c1d5733d10a0257697cfea373. The analysis of this commit reveals changes in lib/index.js within the internals.Client class. The core of the fix is in the request method, which contains the redirect logic. Before the patch, there was a specific check to remove the Authorization and Cookie headers. The patch introduces a new Set called sensitiveCrossHostHeaders which includes authorization, cookie, and, crucially, proxy-authorization. The redirect logic was updated to use this set to determine which headers to strip, thus mitigating the vulnerability. Therefore, the Client.request function is the vulnerable function as it contains the flawed redirect logic.