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

Commit

Permalink
Fix access token leak to logs from proxyagent (#13855)
Browse files Browse the repository at this point in the history
This can happen specifically with an application service `/transactions/10722?access_token=leaked` request

Fix #13010

---

Saw an example leak in #13423 (comment)

```
2022-08-04 14:47:57,925 - synapse.http.client - 401 - DEBUG - as-sender-signal-1 - Sending request PUT http://localhost:29328/transactions/10722?access_token=<redacted>
2022-08-04 14:47:57,926 - synapse.http.proxyagent - 223 - DEBUG - as-sender-signal-1 - Requesting b'http://localhost:29328/transactions/10722?access_token=leaked' via <HostnameEndpoint localhost:29328>
```
  • Loading branch information
MadLittleMods committed Sep 23, 2022
1 parent e3512a7 commit db868db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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.
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

0 comments on commit db868db

Please sign in to comment.