From 4ee379d3b373c4cbbf9c4ccaf7f7986119835819 Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Fri, 29 Dec 2023 15:17:08 +0000 Subject: [PATCH] fix: bcrypt salt must be 22 characters long In addition to bcrypt salt rejecting underscores amongst other characters it must also be exactly 22 characters long. --- utils/kayobe-automation-redact | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/utils/kayobe-automation-redact b/utils/kayobe-automation-redact index a20deb7..4e0b51f 100755 --- a/utils/kayobe-automation-redact +++ b/utils/kayobe-automation-redact @@ -6,17 +6,22 @@ import base64 import sys annotation_exceptions = { - 'prometheus_bcrypt_salt': 'prometheusbcryptsalt' + 'prometheus_bcrypt_salt': {'original': 'prometheusbcryptsalt.o', 'changed': 'prometheusbcryptsalt.c'}, } + def annotate(ctx, value): if not isinstance(value, str): - return value - path_str = ctx['path'][0] + return value + path_str = *map(str, ctx['path']), if path_str in annotation_exceptions: - return f"{annotation_exceptions[path_str]}.{value}" + if isinstance(annotation_exceptions[path_str], str): + return f"{annotation_exceptions[path_str]}.{value}" + else: + return annotation_exceptions[path_str][value] else: - return f"{path_str}.{value}" + 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