Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix access token leak to logs from proxyagent #13855

Merged
merged 5 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13855.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix access token leak to logs from proxy agent.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know where the ProxyAgent was being used? Is there anything other than the case described at #13010 which is worth highlighting?

Would be nice to have in the changelog, but don't stress if this isn't obvious.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's used all over but I guess that makes sense for the purpose of the proxy. Feel free to suggest better language here.

SimpleHttpClient

  • ApplicationServiceApi
  • get_simple_http_client()
  • get_proxied_blacklisted_http_client()

MatrixFederationHttpClient

  • get_federation_http_client()

MatrixHostnameEndpoint

7 changes: 6 additions & 1 deletion synapse/http/proxyagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from twisted.web.http_headers import Headers
from twisted.web.iweb import IAgent, IBodyProducer, IPolicyForHTTPS

from synapse.http import redact_uri
from synapse.http.connectproxyclient import HTTPConnectProxyEndpoint, ProxyCredentials
from synapse.types import ISynapseReactor

Expand Down Expand Up @@ -220,7 +221,11 @@ def request(
self._reactor, parsed_uri.host, parsed_uri.port, **self._endpoint_kwargs
)

logger.debug("Requesting %s via %s", uri, endpoint)
logger.debug(
"Requesting %s via %s",
redact_uri(uri.decode("ascii", errors="replace")),
endpoint,
)

if parsed_uri.scheme == b"https":
tls_connection_creator = self._policy_for_https.creatorForNetloc(
Expand Down