mirror of
https://github.com/aclist/dztui.git
synced 2026-08-26 17:57:06 +02:00
feat: redact user id in logs
Some checks failed
Mirror to Codeberg / mirror-to-codeberg (push) Has been cancelled
Some checks failed
Mirror to Codeberg / mirror-to-codeberg (push) Has been cancelled
This commit is contained in:
parent
7edb66c311
commit
525de56036
@ -4,8 +4,9 @@ from typing import Literal
|
||||
|
||||
api_filter = r"(.*&key=)([^&]*)(.*)"
|
||||
home_filter = r"(/home/)([^\s'\/]*)(.*)"
|
||||
user_filter = r"(.*Steam/userdata/)([^/]*)(.*)"
|
||||
REDACTED = r"\1REDACTED\3"
|
||||
REDACTION_PATTERNS = [api_filter, home_filter]
|
||||
REDACTION_PATTERNS = [api_filter, home_filter, user_filter]
|
||||
|
||||
|
||||
def redact_home(text: str) -> str:
|
||||
|
||||
@ -37,6 +37,14 @@ class RecordsListHandler(logging.Handler):
|
||||
"Error in directory: '/home/SENSITIVE_USERNAME'",
|
||||
"Error in directory: '/home/REDACTED'",
|
||||
),
|
||||
(
|
||||
"User directory: /home/user/.local/share/Steam/userdata/999999/grid",
|
||||
"User directory: /home/REDACTED/.local/share/Steam/userdata/REDACTED/grid",
|
||||
),
|
||||
(
|
||||
"User directory: /drive/.local/share/Steam/userdata/999999",
|
||||
"User directory: /drive/.local/share/Steam/userdata/REDACTED",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_log_redaction(log_error: str, expect: str) -> None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user