Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion astrbot/dashboard/routes/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,17 @@ async def download_backup(self):
if not jwt_secret:
return Response().error("服务器配置错误").__dict__

jwt.decode(token, jwt_secret, algorithms=["HS256"])
# Verify JWT token with strict security options
jwt.decode(
token,
jwt_secret,
algorithms=["HS256"],
options={
"require": ["exp"], # Require expiration claim
"verify_signature": True, # Explicitly verify signature
"verify_exp": True, # Verify expiration
}
)
except jwt.ExpiredSignatureError:
return Response().error("Token 已过期,请刷新页面后重试").__dict__
except jwt.InvalidTokenError:
Expand Down