fix(security): show a message when password reset answers are throttled - #2325
Conversation
|
Paired server change: WISE-Community/WISE-API#324 |
hirokiterashima
left a comment
There was a problem hiding this comment.
Thanks for adding this feature!
Functionality works as described, but I think we should mirror the view/flow that the teacher sees (see below). After too many failed attempts, the form controls are disabled, and we show them a link to the forgot teacher password page to start the flow again. This prevents immediate re-attempts and also adds another extra step/deterrent for the attacker.
|
The Root cause: ref: ${{ github.head_ref || github.ref_name }}without specifying Since A few other issues in the same file worth fixing while at it:
Could a maintainer fix For context: I checked the last 100 PRs on this repo and this is the only cross-repo (fork) one — everyone else pushes branches directly to this repo, so this code path has apparently never been exercised before. |
|
Pushed one more commit addressing a defect in the previous one. When I moved the message below the form to add the "Forgot Student Password" link, I dropped the The guard is restored and each spec now asserts that nothing is drawn there on load. The assertion queries The |
|
Hi @Isaries, thanks for the latest fix commit. We recently addressed the generate-messages issue in this PR: #2334. You should now see a different error when the GitHub actions run and fails on PRs from forked branches, as this one did here: https://github.com/WISE-Community/WISE-Client/actions/runs/33351721843/job/99673772548?pr=2325 Can you please try generating the new messages.xlf file and committing it? Thanks for your patience and understanding! |
The server now temporarily blocks the student password reset flow after several incorrect security answers to prevent brute forcing the answer. The security answer step previously ignored any unrecognized response code, so a throttled user saw a blank error and no explanation. Handle the throttling response code in both the security answer and password change steps so the user is told to wait or to ask their teacher.
…tled Showing only a message let a throttled student keep submitting answers. Mirror the teacher verification code flow: disable the form and show a link back to the start of the flow, with the warning and the link below the form where the teacher flow puts them. Unlike the teacher flow there is no new verification code for a student to generate, so the message tells them to wait and start again or to ask their teacher rather than promising the link will unblock them. The security answer step also had no default branch, so any response code it did not recognise left the message undefined and the student saw nothing at all. The server returns invalidUsername from that endpoint when the account has gone away mid-flow, which reached exactly that dead end. Both steps now share a base class holding the message state and the lockout, so the two copies of the response text cannot drift apart.
Moving the message below the form dropped the @if (message) guard that used to wrap it, and message is the empty string until something fails, so both cards rendered an empty p.warn with its own vertical margin on every visit. Restore the guard and assert its absence on load. The assertion queries .warn rather than the paragraph itself, so it fails if anything empty is drawn there, and it does fail against the unguarded template.
5145297 to
cdee49a
Compare
…the answer The change step carries the security answer in query params, so the student cannot correct it on that page. Mapping incorrectAnswer to the generic error left them resubmitting the same rejected answer, and the server now counts each submission against the limit that locks the reset for ten minutes, so they were told only that an error occurred until they were locked out. Announce both messages through a live region that is present before the message arrives. The paragraph moved below the form to sit next to the link, and the answer field is disabled while focus is still on it, so nothing was reaching assistive technology.
|
Hi @hirokiterashima, thanks for fixing I have regenerated While revisiting the branch I also found two things worth fixing, in the last commit:
Both are covered by specs, and I checked that the new assertions fail against the code without these changes rather than assuming they would. One thing I cannot do from my side: the workflow runs on this PR are waiting for maintainer approval, so Also, the earlier review is still marked as changes requested. The form is now disabled and the link back to the Forgot Student Password page is shown after too many failed attempts, matching the teacher flow in your screenshot, so whenever you have time I would appreciate another look. Thanks again for your patience with this one. |
My original request has been addressed. Still figuring out the issue with conflicting messages.xlf now.
|
@Isaries can you try running |
The committed file did not match what npm run extract-i18n produces on the Linux runner, so the generate-messages check failed. Neither cause is visible from a Windows checkout. The extractor reports the end line of a multi-line i18n block one higher on Windows than on Linux. Separately, the equiv-text attributes carry multi-line source snippets whose CR characters are content rather than line endings, and core.autocrlf strips them when the file is staged. Regenerated in a node:24 container and staged with the filter disabled, so the file is byte-identical to what the workflow regenerates. Most of the diff is the same correction applied to strings this branch never touched.
|
Hi @hirokiterashima, thanks for looking again. I ran I reproduced the job locally in a
The file in this PR is now byte-identical to what the workflow regenerates, so the check should pass. One thing worth raising separately. Regenerating from a pristine The practical consequence for this PR is that |
|
Thanks @Isaries. This PR brought up good points that we need to consider. |
|
🎉 This PR is included in version 5.238.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
This pairs with the WISE-API change that throttles the student password reset flow after several incorrect security answers. The server now returns a throttling response code. The security answer step previously ignored any unrecognized response code, so a throttled user saw a blank error with no explanation.
Changes
Paired change
Paired with the WISE-API change (branch
fix/student-reset-throttle) that adds the throttling.