From ca25ec3dbca6b4bf1c29be39788e0fb4d58956f7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 31 Jan 2020 15:00:03 +0100 Subject: [PATCH] Increase size of the verificationCode It's mostly a theoretical problem, but 16 could theoretically be brute forced. Bumping it up to 32 won't break anything, but it does make it exteremely unlikely that it gets broken --- cura/OAuth2/AuthorizationHelpers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/OAuth2/AuthorizationHelpers.py b/cura/OAuth2/AuthorizationHelpers.py index 9fc01ba50b..cc809abf05 100644 --- a/cura/OAuth2/AuthorizationHelpers.py +++ b/cura/OAuth2/AuthorizationHelpers.py @@ -115,9 +115,10 @@ class AuthorizationHelpers: ) @staticmethod - ## Generate a 16-character verification code. - # \param code_length: How long should the code be? - def generateVerificationCode(code_length: int = 16) -> str: + ## Generate a verification code of arbitrary length. + # \param code_length: How long should the code be? This should never be lower than 16, but it's probably better to + # leave it at 32 + def generateVerificationCode(code_length: int = 32) -> str: return "".join(random.choice("0123456789ABCDEF") for i in range(code_length)) @staticmethod