-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Fix ios authenticationValidityDurationSeconds #73
Conversation
I did quite a few refactorings.. but I think I now understand how it is working and how it is supposed to work..
I played around with the I don't think it is valid to reuse the |
I think this depends on what the LAContext is intended to be used for.
It was my understanding that the In my opinion, the end user benefits most from this setting when it behaves in the 2nd way (especially if it's a user-facing setting as mentioned in #75). If you disagree (or even if you don't!) there could be a benefit to creating a new configuration parameter I've prefixed with I can see you've done a lot of work refactoring this part of the code recently so I'll hold off making any specific code suggestions for now while you're actively working on it, but if you want me to rebase my branch and work on any particular changes just let me know - I should have a bit of time in the next couple of weeks. |
Can you find any source of this in the apple documentation? I don't think this is the indented behavior at all. My concern is, that this is undocumented behavior and might lead to further bugs or unintended security problems.
Well, it was, but I didn't know that this is not actually a feature iOS/MacOS provides. I'm also pretty sure that the last sentence of the I actually think the best way would be ..
Do you think that makes sense? I guess it would be the best to understand.. and users have everything under control.. |
No. Also no documentation about implementing it in the other way either. I therefore conclude that it is entirely up to us to decide under which circumstances it is appropriate to reuse the context and when it should be destroyed. I share your concern but see nothing to suggest that there is a specific prescribed way in which the context must be used, so I think the uncertainty is not resolved by simply discarding the context. I'm not sure if @radvansky-tomas has had a chance to review any of this discussion yet but given they recently submitted the PR to re-use the context, it's possible they can point us to further documentation we've missed or at least impart some wisdom regarding this topic.
https://stackoverflow.com/questions/38379125/touchid-activatetouchwithresponse-returns-success-without-requesting-fingerprint#comment110453577_40471007 seems to hint at a time when Apple significantly changed the documentation on this subject which probably explains why your earlier research into the topic led to the initial implementation and our ongoing uncertainty about what is supposed to be supported. By the way, although the documentation was supposedly changed in iOS 13, the behaviour I see on iOS 12 matches that updated documentation. In any case, I think your suggested approach will put sufficient control into the library consumers and therefore end-users so that the question of what Apple actually intended can be deferred. If anyone later finds additional documentation or guidance which would help library consumers select their own suitable configuration values, we can reference that without having to change the behaviour of the new properties. I have a few questions / comments before you implement it:
Perhaps a similar approach to the PromptInfo class could be used so we can easily add additional platforms in future? Then we can probably do away with some of the prefixes on the property names and also create a neat place to later add support for restricting by authentication type once that idea gets more refined. Something like this?
Could instead put the AuthenticationConfiguration variables on IosAuthenticationConfiguration but maybe making them read-only on the base class would help reinforce that they can be configured independently on iOS but will be set to the same on Android? I expect you'll have a good idea of what approach works best with the native code interop layer but I figured at least having a base class would allow the configuration to be an unlimited number of platforms in an array (with those common properties defaulting to some reasonable value if no platform configurations are supplied). Maybe later we could move authenticationRequired into that class too in case there is a desire to change that behaviour on just some platforms (e.g. web).
What do you think? By the way, if you prefer to work on a branch for WIP and get a 2nd opinion from me or others before rebasing onto main feel free to ping me. |
Thank you for mention @luckyrat . I didnt check this plugin recently, as the project I used it for is legacy one and it uses my custom fork. At the time of creation, reusing of context / not reusing context had massive impact on iOS based features. As the value touchIDAuthenticationAllowableReuseDuration belongs to context, without it...nothing is passed into. I cant judge Android, as its segmentation and missing core features and implementing custom way of treating secure features by brands like Samsung/Huawei its insanity of different level :D So I would take android as sort of interface for this. |
well.. When the context is discarded, everything works as documented. (no matter the wording of the actual properties). When the context is preserved, weird things start happening (ie. authentication is preserved, no matter what values are set on the reuse duration). ... I think this is a pretty good indication of not using something as intended, when it is not behaving as documented.
MacOS uses exactly the same implementation (it's just symlinked). And behaves very similar. I'm not sure yet if I'd really want to release a new major version to introduce breaking changes.. it feels like those are all bug fixes.. the major version change would only be because the configuration changes :-) |
FWIW, when we updated This could be a potentially critical fix for others that experienced the same issue we did because on |
@hpoul since the 4.1.3 is the latest version on pub and can easily be upgrade to by running a |
This PR retains the LAContext until
authenticationValidityDurationSeconds
have elapsed, thus forcing the user to reauthenticate when it has been that long since either:I've slightly improved it since the earlier commit that was included in #70, to improve clarity and ensure that when
authenticationValidityDurationSeconds <= 0
we always create a new context.