fix: constant-time comparison for share tokens

Applies the reviewer's suggestion on app/auth.py — hmac was already imported.
This commit is contained in:
marcos
2026-08-18 13:00:08 +00:00
parent a1aefa08c7
commit 4e1285dc96
+1 -1
View File
@@ -35,4 +35,4 @@ def make_share_token(note_id: int) -> str:
def check_share_token(supplied: str, expected: str) -> bool: def check_share_token(supplied: str, expected: str) -> bool:
"""Validate a share token supplied in a URL.""" """Validate a share token supplied in a URL."""
return supplied == expected return hmac.compare_digest(supplied, expected)