-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Remove account lockout from failed recovery attempts #35325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ffc6ee9
Remove account lockout from failed recovery attempts
jentfoo 1470545
accountrecovery: Update `WithLock` function names
jentfoo 024b29b
accountrecovery: Combine verifyRecoveryCode and verifyRecoveryCodeWit…
jentfoo b44adb9
Further GRPC cleanup after PR feedback
jentfoo 4add256
Apply PR Feedback
jentfoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,8 +80,6 @@ type User interface { | |
| GetStatus() LoginStatus | ||
| // SetLocked sets login status to locked | ||
| SetLocked(until time.Time, reason string) | ||
| // SetRecoveryAttemptLockExpires sets the lock expiry time for both recovery and login attempt. | ||
| SetRecoveryAttemptLockExpires(until time.Time, reason string) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: it wouldn't hurt to do separate PRs to v14 and v13 which mark this method as deprecated. This way if anyone is using this part of Teleport's API it will start to get flagged for them. |
||
| // ResetLocks resets lock related fields to empty values. | ||
| ResetLocks() | ||
| // SetRoles sets user roles | ||
|
|
@@ -527,18 +525,11 @@ func (u *UserV2) SetLocked(until time.Time, reason string) { | |
| u.Spec.Status.LockedTime = time.Now().UTC() | ||
| } | ||
|
|
||
| // SetRecoveryAttemptLockExpires sets the lock expiry time for both recovery and login attempt. | ||
| func (u *UserV2) SetRecoveryAttemptLockExpires(until time.Time, reason string) { | ||
| u.Spec.Status.RecoveryAttemptLockExpires = until | ||
| u.SetLocked(until, reason) | ||
| } | ||
|
|
||
| // ResetLocks resets lock related fields to empty values. | ||
| func (u *UserV2) ResetLocks() { | ||
| u.Spec.Status.IsLocked = false | ||
| u.Spec.Status.LockedMessage = "" | ||
| u.Spec.Status.LockExpires = time.Time{} | ||
| u.Spec.Status.RecoveryAttemptLockExpires = time.Time{} | ||
| } | ||
|
|
||
| // DeepCopy creates a clone of this user value. | ||
|
|
||
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of this field is making UpdateAndSwapUser fail.
If the stored user had the "recovery_attempt_lock_expires" field set, then the comparison always fails. That is because when we read and unmarshal the user the unknown field gets dropped, but the actual CompareAndSwap operation compares using the storage blobs instead.
Reverting the deletion, but keeping the field deprecated should serve as an immediate fix. Arguably, a better fix is to make sure CompareAndSwap compare apples-to-apples: either user vs user, or blob vs blob, but never user vs blob.
@jentfoo @rosstimothy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just submitted a PR to bring the field back: #37618
Thank you for finding this issue @codingllama!