mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-04 03:42:04 +00:00
Fix timing attack vulnerability in token verification
Replaced insecure string comparison with `secrets.compare_digest` in `_check_token` to prevent timing attacks. Added a test case for missing token to ensure robust error handling. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
46f753a11a
commit
e59cc1af2e
2 files changed
+12
-1
No files matched your search
@@ -65,6 +65,16 @@ def test_invalid_token(client):
|
||||
assert res.status_code == 401
|
||||
|
||||
|
||||
def test_missing_token(client):
|
||||
cl, _token = client
|
||||
# No Authorization header
|
||||
res = cl.get(
|
||||
"/api/v1/entry",
|
||||
params={"query": "s"},
|
||||
)
|
||||
assert res.status_code == 401
|
||||
|
||||
|
||||
def test_get_entry_by_id(client):
|
||||
cl, token = client
|
||||
headers = {
|
||||
|
||||
Reference in new issue
Block a user