Skip to content

Commit 75dc400

Browse files
lfuianballou
authored andcommitted
Fixes #38185 - Hide HTTP(S) proxy password in proxy request logging
1 parent cd26ede commit 75dc400

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/lib/foreman/http_proxy.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ def foreman_logger
5151
end
5252

5353
def log_proxied_request(lib, current_proxy, requested_host)
54-
foreman_logger.info "(#{lib}) Proxying request to #{requested_host} via #{current_proxy}"
54+
foreman_logger.info do
55+
parsed_url = URI(current_proxy)
56+
parsed_url.password = '****' if parsed_url.password.present?
57+
"(#{lib}) Proxying request to #{requested_host} via #{parsed_url}"
58+
end
5559
end
5660

5761
def http_host_excepted_by_wildcard?(host)

0 commit comments

Comments
 (0)