summary refs log tree commit diff
path: root/synapse/http/site.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-06-05 19:08:46 +0100
committerGitHub <noreply@github.com>2018-06-05 19:08:46 +0100
commite316407b5d41da90ded5759d519a93656ff013ad (patch)
tree1bdf25c894a218a3622dd70de60211d52d6e0488 /synapse/http/site.py
parentMerge pull request #3340 from ArchangeGabriel/patch-1 (diff)
parentfactor out uri redaction into a method on http (diff)
downloadsynapse-e316407b5d41da90ded5759d519a93656ff013ad.tar.xz
Merge pull request #3327 from t3chguy/redact_as_request_token
Strip `access_token` from outgoing requests
Diffstat (limited to 'synapse/http/site.py')
-rw-r--r--synapse/http/site.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py
index 60299657b9..2664006f8c 100644
--- a/synapse/http/site.py
+++ b/synapse/http/site.py
@@ -14,18 +14,16 @@
 
 import contextlib
 import logging
-import re
 import time
 
 from twisted.web.server import Site, Request
 
+from synapse.http import redact_uri
 from synapse.http.request_metrics import RequestMetrics
 from synapse.util.logcontext import LoggingContext
 
 logger = logging.getLogger(__name__)
 
-ACCESS_TOKEN_RE = re.compile(br'(\?.*access(_|%5[Ff])token=)[^&]*(.*)$')
-
 _next_request_seq = 0
 
 
@@ -69,10 +67,7 @@ class SynapseRequest(Request):
         return "%s-%i" % (self.method, self.request_seq)
 
     def get_redacted_uri(self):
-        return ACCESS_TOKEN_RE.sub(
-            br'\1<redacted>\3',
-            self.uri
-        )
+        return redact_uri(self.uri)
 
     def get_user_agent(self):
         return self.requestHeaders.getRawHeaders(b"User-Agent", [None])[-1]