SIGN IN SIGN UP

fix: guard against mismatched HMAC length in NexoCrypto.validateHmac (#1703)

crypto.timingSafeEqual throws a raw TypeError when the two buffers differ
in length, so a tampered message with a truncated or malformed HMAC raised
an unhandled TypeError instead of the expected NexoCryptoException. Add a
length check before timingSafeEqual so a length mismatch is treated as an
invalid HMAC. Includes a regression test for a different-length HMAC.
C
Cedric Conday committed
1967d41097a75574a12ca6203bf050af1284202d
Parent: fa8aaba
Committed by Beppe Catanese <1771700+gcatanese@users.noreply.github.com> on 7/7/2026, 12:24:10 PM