Repository navigation
Commit 19e0fb1
Only clear the login nonce once it has expired
An unrecognized nonce no longer discards the pending one. Preserve it and
let it run out its own expiration instead.
Delete-on-mismatch dates back to the original implementation, where the
mismatch and expiry cases shared one branch. It offers no brute-force
resistance -- the key is 256 bits from random_bytes() inside a ten minute
window, it is useless without the second factor, and
validate_login_form_2fa() already rotates it whenever a factor fails --
while allowing any unauthenticated request to end another user's
in-progress login.
Expiry is now checked before the key, so an expired nonce is cleared
whatever was presented alongside it. It can never succeed again, so
deleting it is not destructive, and an abandoned login no longer leaves
dead weight in usermeta until the next password success overwrites it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 93cd055 commit 19e0fb1
2 files changed
Lines changed: 73 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1377 | 1377 | | |
1378 | 1378 | | |
1379 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
1380 | 1393 | | |
1381 | 1394 | | |
1382 | 1395 | | |
1383 | 1396 | | |
1384 | 1397 | | |
1385 | 1398 | | |
1386 | 1399 | | |
1387 | | - | |
1388 | 1400 | | |
1389 | | - | |
| 1401 | + | |
1390 | 1402 | | |
1391 | 1403 | | |
1392 | 1404 | | |
1393 | | - | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
1397 | 1413 | | |
1398 | 1414 | | |
1399 | 1415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
704 | 703 | | |
705 | 704 | | |
706 | 705 | | |
| |||
802 | 801 | | |
803 | 802 | | |
804 | 803 | | |
805 | | - | |
806 | | - | |
807 | | - | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
| |||
897 | 897 | | |
898 | 898 | | |
899 | 899 | | |
900 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
901 | 904 | | |
902 | 905 | | |
903 | 906 | | |
904 | | - | |
| 907 | + | |
905 | 908 | | |
906 | 909 | | |
907 | 910 | | |
| |||
910 | 913 | | |
911 | 914 | | |
912 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
913 | 939 | | |
914 | 940 | | |
915 | | - | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
916 | 960 | | |
917 | 961 | | |
918 | 962 | | |
| |||
0 commit comments