Skip to content

Commit

Permalink
fix: bcrypt salt must be 22 characters long
Browse files Browse the repository at this point in the history
In addition to bcrypt salt rejecting underscores amongst other
characters it must also be exactly 22 characters long.
  • Loading branch information
jackhodgkiss committed Apr 30, 2024
1 parent 262a313 commit 6feb7f6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions utils/kayobe-automation-redact
Original file line number Diff line number Diff line change
Expand Up @@ -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]
if path_str in annotation_exceptions:
return f"{annotation_exceptions[path_str]}.{value}"
return value
path_str = *map(str, ctx['path']),
if path_str[0] in annotation_exceptions:
if isinstance(annotation_exceptions[path_str[0]], str):
return f"{annotation_exceptions[path_str[0]]}.{value}"
else:
return annotation_exceptions[path_str[0]][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
Expand Down

0 comments on commit 6feb7f6

Please sign in to comment.