-
-
Notifications
You must be signed in to change notification settings - Fork 41
Support two-factor authentication in messenger-lite login flow #200
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
Open
radon-at-beeper
wants to merge
30
commits into
main
Choose a base branch
from
rr-bloks-2fa
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
ca90dd6 to
e8066fb
Compare
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.
Add support for both TOTP and AFAD ("approve from another device") two-factor authentication flows. There are more, such as email OTP, but those flows do not appear by default, and show up only when certain security flags are tripped for an account. There is a pretty sophisticated framework in place for handling different traversals of the graph of different login screens, so we should be able to straightforwardly add support for such cases when we see them. All that should be necessary is enabling trace logs when experiencing the issue, and then the interpreter dev tooling can be used to craft the appropriate logic without needing real-time account access or credential sharing.
There are a fair number of framework improvements in this PR, which were needed to get to a place where MFA could be supported without the code becoming a tangled ball.
Browserabstraction that implements a state machine transitioning between multiple Bloks pages and retaining global state. This wraps up a fair bit of duplicative and error-prone code repeatedly needing to instantiate new interpreters and have tons of bigifconditionals.Statefield on the browser, which is an enum that models the graph of ways to traverse through the login flow.bridgev2.LoginStepto request user input. The block is called repeatedly in a loop by higher level code, until it reaches theSuccessstate. So all it needs to do is perform at least one state transition, then the next run will take it from there.DoRPCwithsend_login_request, which the second block will handle by making the relevant Bloks request and setting up the newly rendered page andStateto be processed by the next run through the first block.setInterval, except that rather than doing the scheduling themselves, they call back to the interpreter bridge and provide a callback that will run the timer target, so that the delay can for example be translated into abridgev2.LoginStepTypeDisplayAndWait.AsyncActionWithDataManifestV2standard library call actually interprets some data nested inside one of its arguments as success and failure callbacks. TheDoRPCinterpreter bridge method now also gets passed a callback which can be invoked with the result of the RPC, which is necessary for theafad_stateaction to actually trigger the next phase of the login flow once the server indicates success.minsnamespace. Since several of the new functions require introspecting particular properties oftree.Makefuncalls passed as arguments, that functionality has been split out to a common subroutine.parentandcontainerpointer system within Bloks trees was buggy and ad-hoc; it's been replaced by something much simpler, fixing issues uncovered when usingFindDescendant,FindAncestor,FindCousin, etc.