summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:18:26 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:18:26 +0000
commitd5982cd68798b228ce8dbf53e6e67c9ec9e1a556 (patch)
tree4d125bfdc8c9c559135ce4931f9a15ba2f6b6612 /synapse
parentMerge pull request #6154 from matrix-org/erikj/fix_appservice_pagination (diff)
parentReplace client_secret with <redacted> in server logs (#6158) (diff)
downloadsynapse-d5982cd68798b228ce8dbf53e6e67c9ec9e1a556.tar.xz
Replace client_secret with <redacted> in server logs (#6158)
Diffstat (limited to 'synapse')
-rw-r--r--synapse/http/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/http/__init__.py b/synapse/http/__init__.py
index 3acf772cd1..3880ce0d94 100644
--- a/synapse/http/__init__.py
+++ b/synapse/http/__init__.py
@@ -42,11 +42,13 @@ def cancelled_to_request_timed_out_error(value, timeout):
 
 
 ACCESS_TOKEN_RE = re.compile(r"(\?.*access(_|%5[Ff])token=)[^&]*(.*)$")
+CLIENT_SECRET_RE = re.compile(r"(\?.*client(_|%5[Ff])secret=)[^&]*(.*)$")
 
 
 def redact_uri(uri):
-    """Strips access tokens from the uri replaces with <redacted>"""
-    return ACCESS_TOKEN_RE.sub(r"\1<redacted>\3", uri)
+    """Strips sensitive information from the uri replaces with <redacted>"""
+    uri = ACCESS_TOKEN_RE.sub(r"\1<redacted>\3", uri)
+    return CLIENT_SECRET_RE.sub(r"\1<redacted>\3", uri)
 
 
 class QuieterFileBodyProducer(FileBodyProducer):