Skip to content

Commit 693cc62

Browse files
🔒️ Completely redact secrets
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 88f1fa1 commit 693cc62

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

  • python_jobs/src/hbnmigration/utility_functions

python_jobs/src/hbnmigration/utility_functions/logging.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,9 @@ def redact_secret(secret: str, num_char: int = 4) -> str:
359359
secret
360360
string to redact
361361
num_char
362-
number of characters to leave unredacted
362+
retained for backward compatibility; no characters are left unredacted
363363
364364
"""
365-
return (
366-
f"{'█' * (len(secret) - num_char)}{secret[-num_char:]}"
367-
if len(secret) > num_char
368-
else "█" * len(secret)
369-
)
365+
if not secret:
366+
return "█"
367+
return "█" * len(str(secret))

0 commit comments

Comments
 (0)