Skip to content

Commit 84ee860

Browse files
committed
feat: add support for exceptions to annotations
Some secrets when redacted are rejected due to invalid characters. One example of this would `prometheus_bcrypt_salt` which is rejected due to the use of underscores. Therefore the solution is to add support for exceptions to the standard annotation format. See: https://github.com/ansible/ansible/blob/devel/lib/ansible/utils/encrypt.py#L118C46-L118C46
1 parent 52b5cfa commit 84ee860

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

utils/kayobe-automation-redact

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ import hashlib
55
import base64
66
import sys
77

8+
annotation_exceptions = {
9+
'prometheus_bcrypt_salt': 'prometheusbcryptsalt'
10+
}
11+
812
def annotate(ctx, value):
913
if not isinstance(value, str):
1014
return value
1115
path_str = map(str, ctx['path'])
12-
return f"{'.'.join(path_str)}.{ value }"
16+
if path_str in annotation_exceptions:
17+
return f"{'.'.join(annotation_exceptions['prometheus_bcrypt_salt'])}.{value}"
18+
else:
19+
return f"{'.'.join(path_str)}.{ value }"
1320

1421
def redact_int(ctx, x):
1522
# For numbers we can't indicate change with a string, so use sentinal values

0 commit comments

Comments
 (0)