mirror of
https://github.com/quay/quay.git
synced 2025-04-18 10:44:06 +03:00
chore: Filtering repeatPassword in debuglogs (PROJQUAY-8559) (#3659)
* Filtering repeatPassword in debuglogs * updated test_log_util.py for format issues
This commit is contained in:
parent
4c5b2d50c5
commit
abcf94536b
1
app.py
1
app.py
@ -177,6 +177,7 @@ FILTERED_VALUES = [
|
||||
{"key": ["upstream_registry_password"], "fn": DEFAULT_FILTER},
|
||||
{"key": ["upstream_registry_username"], "fn": DEFAULT_FILTER},
|
||||
{"key": ["user", "password"], "fn": DEFAULT_FILTER},
|
||||
{"key": ["user", "repeatPassword"], "fn": DEFAULT_FILTER},
|
||||
{"key": ["blob"], "fn": lambda x: x[0:8]},
|
||||
]
|
||||
|
||||
|
@ -9,12 +9,22 @@ from util.log import filter_logs, logfile_path
|
||||
|
||||
def test_filter_logs():
|
||||
values = {
|
||||
"user": {"password": "toto"},
|
||||
"user": {"password": "toto", "repeatPassword": "toto"},
|
||||
"password": "toto",
|
||||
"upstream_registry_username": "user",
|
||||
"upstream_registry_password": "testpass",
|
||||
"blob": "1234567890asdfewkqresfdsfewfdsfd",
|
||||
"unfiltered": "foo",
|
||||
}
|
||||
filter_logs(values, FILTERED_VALUES)
|
||||
assert values == {"user": {"password": "[FILTERED]"}, "blob": "12345678", "unfiltered": "foo"}
|
||||
assert values == {
|
||||
"user": {"password": "[FILTERED]", "repeatPassword": "[FILTERED]"},
|
||||
"password": "[FILTERED]",
|
||||
"upstream_registry_username": "[FILTERED]",
|
||||
"upstream_registry_password": "[FILTERED]",
|
||||
"blob": "12345678",
|
||||
"unfiltered": "foo",
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
Loading…
x
Reference in New Issue
Block a user