Commit e3fbb96
Address PR feedback: optimize token deletion and clarify password comparison
This commit addresses code review feedback from Copilot AI:
**1. Clarify password comparison timing attack concern**
- Added detailed comment explaining why equals() is safe for comparing
two user-provided strings (newPassword vs confirmPassword)
- Timing attacks only matter when comparing against stored secrets
- Spring's PasswordEncoder already uses constant-time comparison for
actual credential verification
**2. Optimize password reset token deletion**
- Added @Modifying query method deleteByToken() to PasswordResetTokenRepository
- Uses direct DELETE query instead of SELECT + DELETE
- Reduces database roundtrips from 2 to 1
- Updated UserService.deletePasswordResetToken() to use optimized method
- Maintains logging while improving performance
All tests pass (372 tests).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 3e19f7e commit e3fbb96
File tree
3 files changed
+19
-4
lines changed- src/main/java/com/digitalsanctuary/spring/user
- api
- persistence/repository
- service
3 files changed
+19
-4
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
195 | 199 | | |
196 | 200 | | |
197 | 201 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
55 | 66 | | |
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
414 | 415 | | |
415 | 416 | | |
416 | 417 | | |
417 | 418 | | |
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| |||
0 commit comments