From e1d9a719aa2233144f49ea3ab27bc68597cfcb22 Mon Sep 17 00:00:00 2001 From: wang-qisen Date: Tue, 20 Oct 2026 12:19:55 +0800 Subject: [PATCH] fix(benchmark): redact private keys in MobileMem diagnostics --- benchmark/mobilemem/_audit.py | 4 +-- tests/unit/test_mobilemem_audit.py | 50 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/benchmark/mobilemem/_audit.py b/benchmark/mobilemem/_audit.py index 68e9509d..61d61635 100644 --- a/benchmark/mobilemem/_audit.py +++ b/benchmark/mobilemem/_audit.py @@ -13,7 +13,7 @@ USAGE_POLICY = { "means": "observed run cost amortized over scheduled users / expected questions, not successful samples", } _SENSITIVE = re.compile( - r"authorization|credential|secret|password|api.?key|cookie|headers|" + r"authorization|credential|secret|password|api.?key|private[_-]?key|cookie|headers|" r"(?:^|[_-])(?:access[_-]?token|refresh[_-]?token|id[_-]?token|token)$", re.I, ) @@ -38,7 +38,7 @@ def safe_text(value, limit: int = 1200) -> str: text = re.sub(r"(?