set hash iterations to current OWASP recommendation

This commit is contained in:
Blake Blackshear 2024-05-09 06:22:51 -05:00
parent aa1d02de09
commit 7cf3abc850
2 changed files with 3 additions and 2 deletions

View File

@ -87,7 +87,7 @@ def get_jwt_secret() -> str:
return jwt_secret return jwt_secret
def hash_password(password, salt=None, iterations=260000): def hash_password(password, salt=None, iterations=600000):
if salt is None: if salt is None:
salt = secrets.token_hex(16) salt = secrets.token_hex(16)
assert salt and isinstance(salt, str) and "$" not in salt assert salt and isinstance(salt, str) and "$" not in salt

View File

@ -140,7 +140,8 @@ class AuthConfig(FrigateBaseModel):
default="1/second;5/minute;20/hour", default="1/second;5/minute;20/hour",
title="Rate limits for failed login attempts.", title="Rate limits for failed login attempts.",
) )
users: Optional[List[UserConfig]] = Field(default=[], title="Users") # As of Feb 2023, OWASP recommends 600000 iterations for PBKDF2-SHA256
hash_iterations: int = Field(default=600000, title="Password hash iterations")
class StatsConfig(FrigateBaseModel): class StatsConfig(FrigateBaseModel):