[Bugfix] Redact credentials from benchmark logs (#56662)
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
00972dfd72
commit
8e08cef46e
@@ -9,6 +9,17 @@ from contextlib import contextmanager
|
||||
from typing import Any
|
||||
|
||||
|
||||
def redact_sensitive_namespace(
|
||||
args: argparse.Namespace, fields: tuple[str, ...]
|
||||
) -> argparse.Namespace:
|
||||
"""Return a copy of CLI arguments with selected values redacted."""
|
||||
redacted_args = argparse.Namespace(**vars(args))
|
||||
for field in fields:
|
||||
if getattr(redacted_args, field, None) is not None:
|
||||
setattr(redacted_args, field, "***")
|
||||
return redacted_args
|
||||
|
||||
|
||||
def extract_field(
|
||||
args: argparse.Namespace, extra_info: dict[str, Any], field_name: str
|
||||
) -> str:
|
||||
|
||||
Reference in New Issue
Block a user