1
0
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:
Kotakonda Sai Deekshith 2025-02-11 20:31:31 +05:30 committed by GitHub
parent 4c5b2d50c5
commit abcf94536b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

1
app.py
View File

@ -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]},
]

View File

@ -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(