mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 23:11:34 +01:00
Merge pull request #3349 from t3chguy/redact_as_request_token
Redact AS tokens in log (fixes to #3327)
This commit is contained in:
commit
ad459a106c
2 changed files with 7 additions and 3 deletions
|
@ -292,4 +292,8 @@ class ApplicationService(object):
|
||||||
return self.rate_limited
|
return self.rate_limited
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "ApplicationService: %s" % (self.__dict__,)
|
# copy dictionary and redact token fields so they don't get logged
|
||||||
|
dict_copy = self.__dict__.copy()
|
||||||
|
dict_copy["token"] = "<redacted>"
|
||||||
|
dict_copy["hs_token"] = "<redacted>"
|
||||||
|
return "ApplicationService: %s" % (dict_copy,)
|
||||||
|
|
|
@ -106,14 +106,14 @@ class SimpleHttpClient(object):
|
||||||
incoming_responses_counter.labels(method, response.code).inc()
|
incoming_responses_counter.labels(method, response.code).inc()
|
||||||
logger.info(
|
logger.info(
|
||||||
"Received response to %s %s: %s",
|
"Received response to %s %s: %s",
|
||||||
method, uri, response.code
|
method, redact_uri(uri), response.code
|
||||||
)
|
)
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
incoming_responses_counter.labels(method, "ERR").inc()
|
incoming_responses_counter.labels(method, "ERR").inc()
|
||||||
logger.info(
|
logger.info(
|
||||||
"Error sending request to %s %s: %s %s",
|
"Error sending request to %s %s: %s %s",
|
||||||
method, uri, type(e).__name__, e.message
|
method, redact_uri(uri), type(e).__name__, e.message
|
||||||
)
|
)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue