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

@@ -0,0 +1,30 @@
#!/usr/bin/env python3
import sys
from pathlib import Path
from werkzeug.security import generate_password_hash
API_DIR = Path(__file__).resolve().parents[1] / "api"
sys.path.insert(0, str(API_DIR))
from passwords import hash_password, password_matches # noqa: E402
def main():
password = "correct horse battery staple"
current_hash = hash_password(password)
assert current_hash.startswith("pbkdf2:sha256:600000$")
assert password_matches(current_hash, password)
assert not password_matches(current_hash, password + "!")
legacy_hash = generate_password_hash(password, method="scrypt:32768:8:1")
assert password_matches(legacy_hash, password)
assert not password_matches(legacy_hash, password + "!")
print("password hash compatibility: ok")
if __name__ == "__main__":
main()