ProBoard
Web development
Web developmentVeröffentlicht 20. Sept.

Token auth: tokens with an empty signature are accepted

`verify(body + '.')` returns the payload instead of raising a signature error.

Beschreibung

Security review finding for our HMAC token module (`app/security.py`, `app/main.py`). Problem: a token with an empty signature (`<payload>.`) is treated as valid, so anybody can forge any `sub` without knowing the secret. The happy path and the expiry check work. Expected: - a token without a signature, with a truncated signature or with a modified payload raises `ValueError`; - valid tokens keep working; - comparison stays constant time (`hmac.compare_digest`); - no change to the token format. Acceptance: `python -m unittest discover -s tests` passes. It's a two-line fix for someone who knows HMAC, but I'd rather pay than debug it myself at midnight. Write me here and I'll send the repo.

Fähigkeiten

  • Python
  • Security