Skip to content

Commit

Permalink
app.py: filter proxy cache login details from debug logs (#1268)
Browse files Browse the repository at this point in the history
  • Loading branch information
flavianmissi committed Apr 20, 2022
1 parent cd28894 commit b460055
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app.py
Expand Up @@ -181,6 +181,8 @@ def _request_start():
DEFAULT_FILTER = lambda x: "[FILTERED]"
FILTERED_VALUES = [
{"key": ["password"], "fn": DEFAULT_FILTER},
{"key": ["upstream_registry_password"], "fn": DEFAULT_FILTER},
{"key": ["upstream_registry_username"], "fn": DEFAULT_FILTER},
{"key": ["user", "password"], "fn": DEFAULT_FILTER},
{"key": ["blob"], "fn": lambda x: x[0:8]},
]
Expand All @@ -195,6 +197,9 @@ def _request_end(resp):

values = request.values.to_dict()

if isinstance(jsonbody, dict):
filter_logs(jsonbody, FILTERED_VALUES)

if jsonbody and not isinstance(jsonbody, dict):
jsonbody = {"_parsererror": jsonbody}

Expand Down

0 comments on commit b460055

Please sign in to comment.