Repository navigation
Commit 1c30951
committed
test(auth): set KeyHash in singleflight fixture for constant-time check
ValidateUserAPIKey now runs subtle.ConstantTimeCompare(key.KeyHash, keyHash)
after the DB fetch. The TestValidateUserAPIKey_LastUsedSingleflight fixture
omitted KeyHash, so the empty stored hash failed the compare and the function
returned early before the background UpdateAPIKeyLastUsed ran, breaking the
mock's Once expectation. Real DB rows always carry KeyHash, so the fixture
must set it to represent the actual validated path.1 parent 148c0a5 commit 1c30951
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
0 commit comments