fix(starpost): bound authentication memory

This commit is contained in:
scandalist-trash committed 2026-10-25 10:21:50 -04:00
1 parent 393e7a13f4
commit b4870b401a
4 files changed
+50 -4

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
from werkzeug.security import check_password_hash, generate_password_hash
# Werkzeug's default scrypt hash needs about 32 MiB of working memory per
# concurrent request. The API serves up to four authentication requests at a
# time, so use a CPU-bound hash for new accounts while retaining verification
# support for existing scrypt hashes.
PASSWORD_HASH_METHOD = "pbkdf2:sha256:600000"
def hash_password(password):
return generate_password_hash(password, method=PASSWORD_HASH_METHOD)
def password_matches(password_hash, password):
return check_password_hash(password_hash, password)