Skip to content

Commit 10746d2

Browse files
committed
Increase token size to 32 bytes
This fix bumps the token size from 16 to 32 bytes in order to match the default minimum entropy as recommended by Python docs. Note, that there is also a comparison to a constant TOKEN_ΜΙΝ_LEN where one module assumed that length to be characters and another module (utils.py) assumes that length to be bytes. So this fix uses bytes as the meaning from now on. Fixes canonical#4481 Signed-off-by: Eric Brown <[email protected]>
1 parent f9eb294 commit 10746d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/wrappers/add_token.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ def print_short(token, check):
163163
if args.token is not None:
164164
token = args.token
165165
else:
166-
token = token_hex(16)
166+
token = token_hex(32)
167167

168168
if len(token) < TOKEN_ΜΙΝ_LEN:
169-
print("Invalid token size. It must be 32 characters long.")
169+
print("Invalid token size. It must be 32 bytes long.")
170170
exit(1)
171171

172172
add_token_with_expiry(token, cluster_tokens_file, ttl)

0 commit comments

Comments
 (0)