LG-11454: Restore successful WebAuthn delete handling user events#9780
Merged
LG-11454: Restore successful WebAuthn delete handling user events#9780
Conversation
changelog: User-Facing Improvements, Face or Touch Unlock, Add option to rename face or touch unlock in account dashboard
aduth
commented
Dec 18, 2023
Comment on lines
+38
to
+41
| create_user_event(:webauthn_key_removed) | ||
| revoke_remember_device(current_user) | ||
| event = PushNotification::RecoveryInformationChangedEvent.new(user: current_user) | ||
| PushNotification::HttpPush.deliver(event) |
Contributor
Author
There was a problem hiding this comment.
Separately, it might be worth thinking about extracting this behavior, since we're doing several things here, and we have the same code across basically all of MFAs... or at least I expect we intend to, but the RISC events aren't consistently implemented (even more justification to extract a common helper).
e.g.
module TwoFactorAuthenticatableMethods
# ...
def handle_valid_auth_method_removed(user_event:)
create_user_event(user_event)
revoke_remember_device(current_user)
event = PushNotification::RecoveryInformationChangedEvent.new(user: current_user)
PushNotification::HttpPush.deliver(event)
end
end
zachmargolis
approved these changes
Dec 18, 2023
jmdembe
approved these changes
Dec 18, 2023
Merged
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.
🎫 Ticket
Relates to LG-11454 (originally #9674)
🛠 Summary of changes
Restores additional behaviors expected to occur after the successful deletion of a WebAuthn credential.
I noticed these after starting to put together the clean-up pull request to remove the old deletion routes, which implement these behaviors:
identity-idp/app/controllers/users/webauthn_setup_controller.rb
Lines 148 to 152 in 8558b0b
📜 Testing Plan
Verify specs pass:
rspec spec/controllers/api/internal/two_factor_authentication/webauthn_controller_spec.rb spec/controllers/users/webauthn_controller_spec.rbYou can also verify that behaviors actually happen when deleting Face or Touch Unlock:
User.find_with_email('email@example.com').events.webauthn_key_removed