Skip to content
vetkitChecksChangelogDocumentation

vetkit.js.crypto.timing-unsafe-compare

An HMAC/signature is compared with ===/!==. Ordinary string comparison returns early at the first differing byte, which can leak the expected value through response timing.

Last updated:

Suite: Security

javascript, typescript

An HMAC/signature is compared with ===/!==. Ordinary string comparison returns early at the first differing byte, which can leak the expected value through response timing.

Category: SECURITY · Engine rule severity: INFO

How to fix it

Compare equal-length buffers with crypto.timingSafeEqual(Buffer.from(a), Buffer.from(b)) after checking the lengths.

References

Source: packages/engine/rules/sast/javascript.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.