Web developmentVeröffentlicht 30. Sept.
Token auth: expired tokens are still accepted
Token lifetime is not enforced: tokens signed a day ago still pass `verify()`.
Beschreibung
Custom HMAC token library used by a FastAPI service (`app/security.py`, `app/main.py`).
Problem: `verify()` accepts tokens whose `exp` is in the past. A token issued with `ttl=-5` must raise `ValueError("token expired")`, but it is returned as valid. Tokens without `exp` must stay valid (legacy clients).
Expected:
- expired tokens rejected with `ValueError`;
- tokens without `exp` still accepted;
- signature check unchanged.
Acceptance: `python -m unittest discover -s tests` passes.
DM me and I'll send the archive plus a sample expired token. Payment the moment the tests are green.
Fähigkeiten
- Python
- FastAPI
- Security