Skip to content
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

Fixed a security issue #22

Merged
merged 1 commit into from
Sep 15, 2016
Merged

Fixed a security issue #22

merged 1 commit into from
Sep 15, 2016

Conversation

happylance
Copy link

Previously, inccorectPasscodeAttempts was reset to 0 after kill and restart. So an attacker can bypass the maximumInccorectPasscodeAttempts setting by killing and restarting the app after trying a different password again and again.

@ziogaschr
Copy link
Collaborator

Thanks a lot for finding this one @happylance. Will test it soon, but it looks good

trispo pushed a commit to kfinteractive/SwiftPasscodeLock that referenced this pull request May 26, 2016
@le4ker
Copy link

le4ker commented Jun 6, 2016

I also found this bug, but I mitigated it by recreating the instance (in order to reset the state of the instance).

@ziogaschr
Copy link
Collaborator

@happylance I think that the initial intention of @yankodimitrov was to leave handling of the persistance layer to the developer. Some may prefer Keychain over NSUserDefaults or even another mechanism.

I have tried to help over with this by adding example code in the demo app. Can you please have a look at PR #27. Let me know what you think of this.

Also this PR has part of you changes in this PR. I will be more than happy to remove them from my PR if you will to change the code in this PR, so as all the Kudoz comes to you 👍

Thanks for helping

@happylance
Copy link
Author

PR #27 looks good. Thanks.

@happylance happylance closed this Jun 11, 2016
@ziogaschr
Copy link
Collaborator

As @PanosSakkos correctly pointed there is path that is not handled.

You can test it like in the PR #27 demo:

  1. Enable passcode lock
  2. Home button
  3. Open demo app
  4. Try 3 non-mathcing pin combinations
  5. Quit app
  6. Go to 3

What we can do is to add a method in PasscodeRepositoryType like var incorrectPasscodeAttempts: Int { get set }

What do you think?

@ziogaschr ziogaschr reopened this Jun 12, 2016
@happylance
Copy link
Author

Sorry that I do not understand why incorrectPasscodeAttempts should be part of PasscodeRepositoryType.

@ziogaschr
Copy link
Collaborator

Because then the developer who uses the library will have to implement where (Keychain, NSUserDefaults) and how to persist the incorrectPasscodeAttempts

@happylance
Copy link
Author

I see. My only concern is that it will make this library too complicated to use.

@ziogaschr
Copy link
Collaborator

Let's make it optional. So as only people who need this will implement it.

Let me know if you find it a good idea and also if you will make a PR or I shall add this in PR #27 so as we can do a squash of commits

Sent from my iPhone

On 12 ???? 2016, at 17:37, happylance <notifications@github.commailto:notifications@github.com> wrote:

I see. My only concern is that it will make this library too complicated to use.

You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHubhttps://github.com//pull/22#issuecomment-225438454, or mute the threadhttps://github.com/notifications/unsubscribe/AAw_jM96GG34W0tp5y2YxVI8zYohMumqks5qLBmjgaJpZM4IfAYb.

@happylance
Copy link
Author

I think it is better to handle incorrectPasscodeAttempts correctly within this library so that it will be easier to use. You can add it in PR #27.

@le4ker
Copy link

le4ker commented Jun 12, 2016

@ziogaschr thanks for the fix! 👏

@ziogaschr
Copy link
Collaborator

ziogaschr commented Jun 12, 2016

Let's thanks @happylance and you (@PanosSakkos), rather than me :)

@ziogaschr
Copy link
Collaborator

add a method in PasscodeRepositoryType like var incorrectPasscodeAttempts: Int { get set }

This is not easy without more changes in the library. I am thinking what's the best way, in order to keep the storage mechanism option to the developers.

@yankodimitrov can you suggest something on this topic?

@le4ker
Copy link

le4ker commented Jun 13, 2016

By the way shouldn't the pod (patch) version be increased?

@ziogaschr
Copy link
Collaborator

Good point, we can do this, although we can't update the Pod repository as this is not the main repo.
Try to use this pod 'PasscodeLock', :git => 'https://github.com/ziogaschr/SwiftPasscodeLock.git', :branch => 'master' in your Podfile

@le4ker
Copy link

le4ker commented Jun 13, 2016

Isn't your repository the first result here?

// I'm not familiar with how publishing on cocoapods works 😋

@ziogaschr
Copy link
Collaborator

Woow, I didn't know this. Nice work @velikanov.
So, let's merge some of PRs and update the version later this week.

Nice catch @PanosSakkos

@le4ker
Copy link

le4ker commented Jun 16, 2016

Bump! 💥

Any ETA on when this fix will go in? 😄

@le4ker
Copy link

le4ker commented Jun 19, 2016

Is there any reason that this PL wasn't merged yet? 😟

@velikanov velikanov merged commit ba70b2c into velikanov:master Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants