fix: patch CVE dependencies and path traversal risks
Upgrade aiohttp and related packages, harden local file and storage path checks, tighten password/JWT comparisons, and default Docker forwarded IP trust to empty.
This commit is contained in:
1 parent
c676458370
commit
00f3abd3b2
7 files changed
+199
-36
No files matched your search
+3
-2
@@ -4,6 +4,7 @@
|
||||
# @Software: PyCharm
|
||||
import datetime
|
||||
import hashlib
|
||||
import hmac
|
||||
import os
|
||||
import re
|
||||
import secrets
|
||||
@@ -124,10 +125,10 @@ def verify_password(password: str, hashed: str) -> bool:
|
||||
return False
|
||||
_, salt, stored_hash = parts
|
||||
password_hash = hashlib.sha256(f"{salt}{password}".encode()).hexdigest()
|
||||
return password_hash == stored_hash
|
||||
return hmac.compare_digest(password_hash, stored_hash)
|
||||
|
||||
# 旧格式: 明文比较 (兼容迁移前的数据)
|
||||
return password == hashed
|
||||
return hmac.compare_digest(str(password), str(hashed))
|
||||
|
||||
|
||||
def is_password_hashed(password: str) -> bool:
|
||||
|
||||
Reference in new issue
Block a user