fix(security): raise RuntimeError for unset jwt_secret_key to enhance server safety

This commit is contained in:
MingxuanGame
2025-10-04 08:04:23 +00:00
parent 1163a93053
commit d1d2bd55a0

View File

@@ -260,9 +260,8 @@ async def http_exception_handler(request: Request, exc: HTTPException): # noqa:
if settings.secret_key == "your_jwt_secret_here": # noqa: S105 if settings.secret_key == "your_jwt_secret_here": # noqa: S105
system_logger("Security").opt(colors=True).warning( raise RuntimeError(
"<y>jwt_secret_key</y> is unset. Your server is unsafe. " "jwt_secret_key is unset. Your server is unsafe. Use this command to generate: openssl rand -hex 32"
"Use this command to generate: <blue>openssl rand -hex 32</blue>."
) )
if settings.osu_web_client_secret == "your_osu_web_client_secret_here": # noqa: S105 if settings.osu_web_client_secret == "your_osu_web_client_secret_here": # noqa: S105
system_logger("Security").opt(colors=True).warning( system_logger("Security").opt(colors=True).warning(