Skip to content

Commit 3ccd633

Browse files
VakarisZmssalvatore
authored andcommitted
Island: Shorten OTP to 16 characters
16 characters is plenty secure for a token with a 2-minute lifespan and shortens the payload sufficiently Issue #4187 PR #4188
1 parent b28e390 commit 3ccd633

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

monkey/monkey_island/cc/services/authentication_service/authentication_facade.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .user import User
1717

1818
OTP_EXPIRATION_TIME = 2 * 60 # 2 minutes
19+
OTP_LENGTH = 16
1920

2021

2122
class AuthenticationFacade:
@@ -87,7 +88,9 @@ def generate_otp(self) -> OTP:
8788
8889
The generated OTP is saved to the `IOTPRepository`
8990
"""
90-
otp = OTP(secure_generate_random_string(32, string.ascii_letters + string.digits + "._-"))
91+
otp = OTP(
92+
secure_generate_random_string(OTP_LENGTH, string.ascii_letters + string.digits + "._-")
93+
)
9194
expiration_time = time.monotonic() + OTP_EXPIRATION_TIME
9295
self._otp_repository.insert_otp(otp, expiration_time)
9396

0 commit comments

Comments
 (0)