Commit 3af53a5
fix(auth): use raw timingSafeEqual instead of HMAC for password compare
CodeQL's js/insufficient-password-hash rule re-fires on HMAC because it
taint-tracks any hashing primitive applied to a password value. The rule
is aimed at password *storage*; we're doing in-memory equality.
Switch to crypto.timingSafeEqual on raw UTF-8 buffers — Node's recommended
pattern — and run a self-compare on length mismatch so the branch cost
stays roughly constant. No hash, no rule trigger.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 1ade719 commit 3af53a5
1 file changed
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
302 | | - | |
303 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
304 | 308 | | |
305 | 309 | | |
306 | 310 | | |
| |||
0 commit comments