fix(auth): Added trimming to jwt secret token read from .jwt_secret

Added cleaning of leading and trailing spaces and special characters from a line when reading a secret token from a `.jwt_secret` file
This commit is contained in:
MkSavin 2025-02-11 05:43:41 +03:00 committed by GitHub
parent 198d067e25
commit c9d9aa9b44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -134,7 +134,7 @@ def get_jwt_secret() -> str:
logger.debug("Using jwt secret from .jwt_secret file in config directory.") logger.debug("Using jwt secret from .jwt_secret file in config directory.")
with open(jwt_secret_file) as f: with open(jwt_secret_file) as f:
try: try:
jwt_secret = f.readline() jwt_secret = f.readline().strip()
except Exception: except Exception:
logger.warning( logger.warning(
"Unable to read jwt token from .jwt_secret file in config directory. A new jwt token will be created at each startup." "Unable to read jwt token from .jwt_secret file in config directory. A new jwt token will be created at each startup."