mirror of
https://github.com/curl/curl.git
synced 2026-08-24 13:03:35 +03:00
http: trim custom header name before the Authorization drop
A custom header name padded with blanks (`Authorization :`) missed the exact-length compare and slipped past the cross-host Authorization and Cookie drop, forwarding the header to the redirect target. Trim the parsed name in both the request and proxy CONNECT header builders. Closes #22178
This commit is contained in:
parent
18475e662c
commit
a36384ab94
4 changed files with 104 additions and 1 deletions
|
|
@ -129,6 +129,9 @@ static CURLcode dynhds_add_custom(struct Curl_easy *data,
|
|||
continue;
|
||||
|
||||
DEBUGASSERT(curlx_strlen(&name) && value);
|
||||
/* trim surrounding whitespace so a padded field name (e.g.
|
||||
`Authorization :`) cannot slip past the Authorization/Cookie check */
|
||||
curlx_str_trimblanks(&name);
|
||||
if(data->state.aptr.host &&
|
||||
/* a Host: header was sent already, do not pass on any custom Host:
|
||||
header as that will produce *two* in the same request! */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue