mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-17 10:59:39 +00:00
Strip Cookie headers on cross-origin redirect
Cookie and Cookie2 headers were forwarded to the new host when following a cross-origin redirect, even though Host, Proxy-Authorization, and Authorization were already stripped. Add them to the removal list so session cookies are not leaked to a different origin.
This commit is contained in:
1 parent
62d899feac
commit
0c1cc8c986
2 files changed
+86
-2
No files matched your search
@@ -13557,8 +13557,8 @@ inline bool ClientImpl::create_redirect_client(
|
||||
|
||||
// Clean up request headers that are host/client specific
|
||||
// Remove headers that should not be carried over to new host
|
||||
auto headers_to_remove =
|
||||
std::vector<std::string>{"Host", "Proxy-Authorization", "Authorization"};
|
||||
auto headers_to_remove = std::vector<std::string>{
|
||||
"Host", "Proxy-Authorization", "Authorization", "Cookie", "Cookie2"};
|
||||
|
||||
for (const auto &header_name : headers_to_remove) {
|
||||
auto it = req.headers.find(header_name);
|
||||
|
||||
Reference in new issue
Block a user