From b9a0d75fe898456b86539646522e061ee00280e1 Mon Sep 17 00:00:00 2001 From: Rafal Lewandowski Date: Mon, 22 Apr 2024 10:48:56 +0200 Subject: [PATCH] fix for invalid characters in bcrypt salt --- utils/kayobe-automation-redact | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utils/kayobe-automation-redact b/utils/kayobe-automation-redact index 258900d..f7fe48b 100755 --- a/utils/kayobe-automation-redact +++ b/utils/kayobe-automation-redact @@ -5,11 +5,25 @@ import hashlib import base64 import sys +annotation_exceptions = { + 'prometheus_bcrypt_salt': {'original': 'prometheusbcryptsalt.o', 'changed': 'prometheusbcryptsalt.c'}, +} + def annotate(ctx, value): if not isinstance(value, str): return value path_str = map(str, ctx['path']) return f"{'.'.join(path_str)}.{ value }" + if not isinstance(value, str): + return value + path_str = *map(str, ctx['path']), + if path_str in annotation_exceptions: + if isinstance(annotation_exceptions[path_str], str): + return f"{annotation_exceptions[path_str]}.{value}" + else: + return annotation_exceptions[path_str][value] + else: + return f"{'_'.join(path_str)}.{value}" def redact_int(ctx, x): # For numbers we can't indicate change with a string, so use sentinal values