Hash JWT token in API

This commit is contained in:
thePR0M3TH3AN
2025-08-03 08:50:57 -04:00
parent 9d80f7b607
commit 9d9f8a8bae
2 changed files with 13 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import sys
import pytest
from fastapi.testclient import TestClient
import hashlib
sys.path.append(str(Path(__file__).resolve().parents[1]))
@@ -48,6 +49,12 @@ def client(monkeypatch):
return client, token
def test_token_hashed(client):
_, token = client
assert api._token != token
assert api._token == hashlib.sha256(token.encode()).hexdigest()
def test_cors_and_auth(client):
cl, token = client
headers = {"Authorization": f"Bearer {token}", "Origin": "http://example.com"}