Repository navigation
Security fix: forgot password and sign-up give one answer for every email - #471
Merged
Merged
Conversation
Security fix. Since #464 forgot-password on a self-hosted install answered with a different status per case (has an account, on the team without one, invited, not on this install), so anyone could learn which emails have accounts or are on the team. Forgot password now answers the same status, body and headers for every email on every install, and no sooner than 2.5 seconds after the ask, so the case can't be timed either: the work (the Cognito reset code, or the set-up email for a team member with no account here) runs while the answer waits, and a slow send carries on after it. Send failures are logged, never answered. The set-up email keeps its once-an-hour limit and the 10/h per IP and 5/h per email limits stay. Self-hosted sign-up answers the same way for invited, existing and refused emails, with the password rules checked for every email first; an email that signed up but never confirmed gets a fresh code. The app client now has preventUserExistenceErrors on. Pins the dashboard to d26225b (CoderHelm/coderhelm #314): the sign-in page shows one message for every email and names both senders.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security fix. #464 made
POST /auth/forgot-passwordon a self-hosted install answer with a different status and sentence per case: has an account, on the team without one, invited, not on this install. Anyone could use it to learn which emails have accounts or are on the team. Self-hosted sign-up had the same leak: 409 for an existing account, 403 for someone not invited. Both endpoints now give one answer for every email, and so does the sign-in page (dashboard pinned to CoderHelm/coderhelm #314).Changes
200 {"status":"sent","message":"If that email can sign in here, we've sent a reset code or a set-up link."}, with the same headers.FORGOT_ANSWER_AFTER). The work runs in a task while the answer waits, so the case can't be timed. A send still running at 2.5 s carries on after the answer.LimitExceeded, which only accounts could hit.200 verification_required: "If that email can join here, we've sent a verification code." It is padded to the same 2.5 s.ResendConfirmationCode; Cognito sends nothing for a confirmed account).preventUserExistenceErrors: true, so Cognito's own errors (sign-in, reset, confirm) don't say whether an email exists./auth/methodstakes no email and returns only the install's senders. Sign-in errors are 401 for a wrong password or an unknown email;not_invitedcomes only after a correct password.confirm-resetandverify-emailreturn 400 for every failure.docs/self-host/sign-in.md): the single answer, what is sent in each case, the even timing, and the sign-up answer.c599a92tod26225b. That adds only Self-host: one organization, closed sign-up, admin-required two-factor sign-in #314: one forgot-password message, both sender lines, the note that a set-up link may come instead of a code, and the sign-up answer.Verification
cargo fmt --check -p gateway,cargo clippy -p gateway --all-targets -- -D warnings,cargo test -p gateway(712 passed).npm test(145 passed, typecheck clean).scripts/bump-dashboard.sh d26225b...(pin check passes). Dashboard Self-host: one organization, closed sign-up, admin-required two-factor sign-in #314 CI was green before merge.