Skip to content
Permalink
Browse files

1.21.3 - 1.4.3

  • Loading branch information...
Mark McGuill
Mark McGuill committed Jan 29, 2019
1 parent 10caab2 commit 12343f64d6523f7c0d62b215d1c5f81a1d3d3d73
Showing with 28,208 additions and 1,078 deletions.
  1. +2 −2 StrongBox Auto Fill/Info.plist
  2. +1 −1 StrongBox Auto Fill/SafesListTableViewController.m
  3. +1,284 −527 StrongBox/Base.lproj/Main.storyboard
  4. +7 −2 StrongBox/BrowseSafeView.m
  5. +10 −82 StrongBox/InitialViewController.m
  6. +1 −1 StrongBox/LocalDeviceStorageProvider.m
  7. +25 −42 StrongBox/OpenSafeSequenceHelper.m
  8. +3 −0 StrongBox/PinEntryController.h
  9. +39 −14 StrongBox/PinEntryController.m
  10. +39 −17 StrongBox/PinEntryController.xib
  11. +20 −34 StrongBox/PinsConfigurationController.m
  12. +1 −0 StrongBox/PreferencesTableViewController.h
  13. +79 −8 StrongBox/PreferencesTableViewController.m
  14. +1 −1 StrongBox/RecordView.m
  15. +4 −5 StrongBox/SelectStorageProviderController.m
  16. +1 −0 StrongBox/Settings.h
  17. +10 −0 StrongBox/Settings.m
  18. +5 −4 StrongBox/StorageBrowserTableViewController.m
  19. +2 −2 StrongBox/StrongBox-Info.plist
  20. +4 −0 StrongBox/WebDAVProviderData.m
  21. +39 −4 StrongboxTests/DavKitTests.m
  22. +28 −0 StrongboxTests/DiceWarePasswordGeneratorTests.m
  23. +1 −1 StrongboxTests/KdbDatabaseTests.m
  24. +1 −1 StrongboxTests/KeePassDatabaseTests.m
  25. +7 −7 StrongboxTests/OtpTests.m
  26. +22 −14 WebDAVConfigurationViewController.xib
  27. +55 −48 WebDAVStorageProvider.m
  28. +7,776 −0 beale.wordlist.txt
  29. +7,776 −0 diceware.wordlist.txt
  30. +7,776 −0 eff_large_wordlist.txt
  31. +1,296 −0 eff_short_wordlist_1.txt
  32. +1,296 −0 eff_short_wordlist_2_0.txt
  33. +2 −1 lib/DAVKit/Core/DAVListingParser.h
  34. +28 −4 lib/DAVKit/Core/DAVListingParser.m
  35. +28 −22 lib/DAVKit/Core/DAVRequest.m
  36. +1 −1 lib/DAVKit/Core/DAVRequests.m
  37. +2 −2 lib/DAVKit/Core/DAVResponseItem.h
  38. +1 −1 lib/DAVKit/Core/DAVResponseItem.m
  39. +1 −1 macbox/MacBox/AppDelegate.m
  40. +2 −2 macbox/MacBox/Base.lproj/Main.storyboard
  41. +2 −2 macbox/MacBox/Info.plist
  42. +1 −0 macbox/MacBox/PreferencesWindowController.h
  43. +3 −1 macbox/MacBox/PreferencesWindowController.m
  44. +20 −7 macbox/MacBox/PreferencesWindowController.xib
  45. +2 −0 macbox/MacBox/Settings.h
  46. +9 −0 macbox/MacBox/Settings.m
  47. +146 −102 macbox/MacBox/ViewController.m
  48. +13 −3 macbox/MacBox/ViewModel.h
  49. +50 −28 macbox/MacBox/ViewModel.m
  50. +1 −1 model/AbstractDatabaseFormatAdaptor.h
  51. +1 −1 model/DatabaseModel.h
  52. +30 −13 model/DatabaseModel.m
  53. +5 −0 model/Node.h
  54. +22 −28 model/Node.m
  55. +12 −1 model/PasswordGenerationParameters.h
  56. +14 −0 model/PasswordGenerationParameters.m
  57. +4 −0 model/PasswordGenerator.h
  58. +123 −4 model/PasswordGenerator.m
  59. +1 −1 model/keepass/Kdb1Database.h
  60. +2 −2 model/keepass/Kdb1Database.m
  61. +1 −1 model/keepass/KdbSerialization.h
  62. +9 −1 model/keepass/KdbSerialization.m
  63. +1 −1 model/keepass/Kdbx4Database.h
  64. +2 −2 model/keepass/Kdbx4Database.m
  65. +1 −1 model/keepass/KdbxSerialization.h
  66. +2 −2 model/keepass/KdbxSerialization.m
  67. +1 −1 model/keepass/KdbxSerializationCommon.h
  68. +19 −3 model/keepass/KdbxSerializationCommon.m
  69. +2 −1 model/keepass/KeePassDatabase.h
  70. +2 −2 model/keepass/KeePassDatabase.m
  71. +8 −8 model/keepass/KeePassGroup.m
  72. +1 −1 model/pwsafe/PwSafeDatabase.h
  73. +7 −7 model/pwsafe/PwSafeDatabase.m
  74. +1 −1 model/pwsafe/PwSafeSerialization.h
  75. +14 −1 model/pwsafe/PwSafeSerialization.m
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.21.1</string>
<string>1.21.2</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
@@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2632</string>
<string>2633</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
@@ -205,7 +205,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
if(model) {
[self performSegueWithIdentifier:@"toPickCredentialsFromSafes" sender:model];
}
[self refreshSafes]; // Duress may have removed one
[self refreshSafes]; // Duress may have removed one
}];
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -397,8 +397,13 @@ - (void)refresh {
self.viewModel.isUsingOfflineCache ? @" [Offline]" : @"",
self.viewModel.isReadOnly ? @" [Read Only]" : @""];

self.items = [[NSMutableArray alloc] initWithArray:self.currentGroup.children];

NSMutableArray* unsorted = [[NSMutableArray alloc] initWithArray:self.currentGroup.children];
BOOL sortNodes = self.viewModel.database.format == kPasswordSafe || !Settings.sharedInstance.uiDoNotSortKeePassNodesInBrowseView;
if(sortNodes) {
[unsorted sortUsingComparator:finderStyleNodeComparator];
}
self.items = unsorted;

// Filter KeePass1 Backup Group if so configured...

if(!Settings.sharedInstance.showKeePass1BackupGroup) {
@@ -63,80 +63,6 @@ - (void)hidePrivacyScreen {
self.imageView = nil;
}

//- (void)showPrivacyScreenOld {
// if(self.privacyScreen != nil) {
// NSLog(@"Privacy screen is already displayed.. not displaying again");
// return; // Already displayed
// }
//
// if([self presentedViewController]) {
// NSLog(@"An existing view controller is already being presented, not displaying privacy screen");
// return; // Already displayed
// }
//
// UINavigationController* nav = [self selectedViewController];
// NSString* className = NSStringFromClass([nav.visibleViewController class]);
//
// if (![nav.visibleViewController isKindOfClass:[StorageBrowserTableViewController class]] && // Google Sign In Broken without this... sigh
// ![className isEqualToString:@"SFAuthenticationViewController"] && // Google Sign In Broken without this... sigh. This is kinda brittle but I see no other way around it.
// ![className isEqualToString:@"ODAuthenticationViewController"] && // OneDrive Personal
// ![className isEqualToString:@"ADAuthenticationViewController"] && // OneDrive Biz
// ![className isEqualToString:@"DBMobileSafariViewController"]) // OneDrive too ]
// {
// NSLog(@"Presenting Privacy Screen over: [%@]", className);
//
// __weak InitialViewController* weakSelf = self;
// self.privacyScreen = [[LockViewController alloc] init];
// self.privacyScreen.onUnlockSuccessful = ^{
// weakSelf.isAppStartupLaunchOfPrivacyScreen = NO;
// [weakSelf hidePrivacyScreen];
// };
//
// [self presentViewController:self.privacyScreen animated:NO completion:nil];
// }
// else {
// NSLog(@"Not Presenting Privacy Screen over Predefined Class: [%@]", className);
// }
//}
//
//- (void)hidePrivacyScreenOld {
// if(self.privacyScreen == nil) {
// NSLog(@"Hiding Privacy Screen = Not Present so nothing to do...");
// return;
// }
//
// BOOL startupLock = NO;
// BOOL timeBasedLock = NO;
//
// if(Settings.sharedInstance.appLockMode != kNoLock) {
// startupLock = self.isAppStartupLaunchOfPrivacyScreen;
//
// if (self.enterBackgroundTime) {
// NSTimeInterval secondsBetween = [[[NSDate alloc]init] timeIntervalSinceDate:self.enterBackgroundTime];
// if (secondsBetween > Settings.sharedInstance.appLockDelay)
// {
// timeBasedLock = YES;
// }
// }
// }
//
// NSLog(@"Hiding Privacy Screen... => startupLock = %d, timeBasedLock = %d", startupLock, timeBasedLock);
//
// if(/* DISABLES CODE */ (YES)) { // !startupLock && !timeBasedLock) {
// if(self.presentedViewController == self.privacyScreen) {
// [self dismissViewControllerAnimated:NO completion:^{
// if([self isInQuickLaunchViewMode]) {
// [self openQuickLaunchPrimarySafe];
// }
// }];
// }
// self.privacyScreen = nil;
// }
// else {
// NSLog(@"Could not Hide Privacy Screen because require lock...");
// }
//}

- (void)appResignActive {
NSLog(@"appResignActive");

@@ -436,10 +362,11 @@ - (void)continueICloudAvailableProcedure {
- (void)importFromManualUiUrl:(NSURL *)importURL {
NSData *importedData = [NSData dataWithContentsOfURL:importURL];

if (![DatabaseModel isAValidSafe:importedData]) {
[Alerts warn:self
title:@"Invalid Safe"
message:@"This is not a valid Strongbox password safe database file."];
NSError* error;
if (![DatabaseModel isAValidSafe:importedData error:&error]) {
[Alerts error:self
title:@"Invalid Safe"
error:error];

return;
}
@@ -485,10 +412,11 @@ - (void)importKey:(StrongboxUIDocument*)document url:(NSURL*)url {
}

-(void)importSafe:(StrongboxUIDocument*)document url:(NSURL*)url canOpenInPlace:(BOOL)canOpenInPlace {
if (![DatabaseModel isAValidSafe:document.data]) {
[Alerts warn:self
title:@"Invalid Safe"
message:@"This is not a valid Strongbox password safe database file."];
NSError* error;
if (![DatabaseModel isAValidSafe:document.data error:&error]) {
[Alerts error:self
title:@"Invalid Safe"
error:error];

return;
}
@@ -413,7 +413,7 @@ - (void)stopMonitoringDocumentsDirectory

NSData *data = [[NSFileManager defaultManager] contentsAtPath:path];

if([DatabaseModel isAValidSafe:data]) {
if([DatabaseModel isAValidSafe:data error:&error]) {
NSLog(@"New File:%@ is a valid safe", item.name);
[newSafes addObject:item];
}
@@ -87,15 +87,13 @@ - (instancetype)initWithViewController:(UIViewController*)viewController

- (void)beginSequence {
if (self.safe.isEnrolledForConvenience && Settings.sharedInstance.isProOrFreeTrial) {
BOOL biometricPossible = !Settings.sharedInstance.disallowAllBiometricId && self.safe.isTouchIdEnabled && Settings.isBiometricIdAvailable;
BOOL biometricPossible = self.safe.isTouchIdEnabled && Settings.isBiometricIdAvailable;
BOOL biometricAllowed = !Settings.sharedInstance.disallowAllBiometricId;

// Show biometric if possible... unless BOTH Bio & PIN are configured but PIN has been disabled, then fall back to full master credentials
if(biometricPossible && !(self.safe.conveniencePin != nil && Settings.sharedInstance.disallowAllPinCodeOpens)) {
if(biometricPossible && biometricAllowed) {
[self showBiometricAuthentication];
}
// Only show PIN code now if it is enabled exclusively (i.e. not also with Touch ID) because if for some
// other reason biometric is disabled we want to fallback to master credentials
else if(!Settings.sharedInstance.disallowAllPinCodeOpens && self.safe.conveniencePin != nil && !self.safe.isTouchIdEnabled) {
else if(!Settings.sharedInstance.disallowAllPinCodeOpens && self.safe.conveniencePin != nil) {
[self promptForConveniencePin];
}
else {
@@ -142,7 +140,12 @@ - (void)promptForConveniencePin {

if (self.safe.failedPinAttempts >= maxFailedPinAttempts) {
self.safe.failedPinAttempts = 0;
self.safe.isTouchIdEnabled = NO;
self.safe.conveniencePin = nil;
self.safe.isEnrolledForConvenience = NO;
self.safe.convenienceMasterPassword = nil;
self.safe.convenenienceKeyFileDigest = nil;

[SafesList.sharedInstance update:self.safe];

[Alerts warn:self.viewController
@@ -627,49 +630,29 @@ - (void)setupConveniencePinAndOpen:(DatabaseModel*)openedSafe
vc1.onDone = ^(PinEntryResponse response, NSString * _Nullable pin) {
[self.viewController dismissViewControllerAnimated:YES completion:^{
if(response == kOk) {
PinEntryController *vc2 = [[PinEntryController alloc] init];
vc2.info = @"Please Confirm Your New Convenience PIN";
vc2.onDone = ^(PinEntryResponse response2, NSString * _Nullable confirmPin) {
[self.viewController dismissViewControllerAnimated:YES completion:^{
if(response2 == kOk) {
if ([pin isEqualToString:confirmPin]) {
if(!(self.safe.duressPin != nil && [pin isEqualToString:self.safe.duressPin])) {
self.safe.conveniencePin = pin;
self.safe.isEnrolledForConvenience = YES;
self.safe.convenienceMasterPassword = openedSafe.masterPassword;
self.safe.convenenienceKeyFileDigest = openedSafe.keyFileDigest;
self.safe.hasBeenPromptedForConvenience = YES;

[SafesList.sharedInstance update:self.safe];

[self onSuccessfulSafeOpen:cacheMode provider:provider openedSafe:openedSafe data:data];
}
else {
[Alerts warn:self.viewController title:@"PIN Conflict" message:@"Your Convenience PIN conflicts with your Duress PIN. Please configure in the Safe Settings" completion:^{
[self onSuccessfulSafeOpen:cacheMode provider:provider openedSafe:openedSafe data:data];
}];
}
}
else {
[Alerts warn:self.viewController title:@"PINs do not match" message:@"Your PINs do not match. You can try again from Safe Settings." completion:^{
[self onSuccessfulSafeOpen:cacheMode provider:provider openedSafe:openedSafe data:data];
}];
}
}
else {
[self onSuccessfulSafeOpen:cacheMode provider:provider openedSafe:openedSafe data:data];
}
if(!(self.safe.duressPin != nil && [pin isEqualToString:self.safe.duressPin])) {
self.safe.conveniencePin = pin;
self.safe.isEnrolledForConvenience = YES;
self.safe.convenienceMasterPassword = openedSafe.masterPassword;
self.safe.convenenienceKeyFileDigest = openedSafe.keyFileDigest;
self.safe.hasBeenPromptedForConvenience = YES;

[SafesList.sharedInstance update:self.safe];

[self onSuccessfulSafeOpen:cacheMode provider:provider openedSafe:openedSafe data:data];
}
else {
[Alerts warn:self.viewController title:@"PIN Conflict" message:@"Your Convenience PIN conflicts with your Duress PIN. Please configure in the Safe Settings" completion:^{
[self onSuccessfulSafeOpen:cacheMode provider:provider openedSafe:openedSafe data:data];
}];
};

[self.viewController presentViewController:vc2 animated:YES completion:nil];
}
}
else {
[self onSuccessfulSafeOpen:cacheMode provider:provider openedSafe:openedSafe data:data];
}
}];
};

[self.viewController presentViewController:vc1 animated:YES completion:nil];
}

@@ -22,6 +22,9 @@ NS_ASSUME_NONNULL_BEGIN
@property NSString* warning;
@property BOOL showFallbackOption;

@property (weak, nonatomic) IBOutlet UIButton *buttonOK;
@property (weak, nonatomic) IBOutlet UIButton *buttonMasterFallback;

@end

NS_ASSUME_NONNULL_END
@@ -11,6 +11,7 @@
@interface PinEntryController ()

@property UIBarButtonItem* okButton;
@property UIToolbar* numberToolbar;

@end

@@ -20,40 +21,49 @@ - (void)viewDidLoad
{
[super viewDidLoad];

UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];

numberToolbar.barStyle = UIBarStyleDefault;

self.okButton = [[UIBarButtonItem alloc]initWithTitle:@"OK" style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad)];

//[self setupAccessoryViewToolbar];

self.buttonMasterFallback.hidden = !self.showFallbackOption;
self.labelSubtitle.text = self.info.length ? self.info : @"Please Enter Your PIN";
self.labelWarning.text = self.warning;

[self validatePin];
}

- (void)setupAccessoryViewToolbar {
self.numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
self.numberToolbar.barStyle = UIBarStyleDefault;

self.okButton = [[UIBarButtonItem alloc]initWithTitle:@"OK" style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad)];

if(self.showFallbackOption) {
numberToolbar.items = @[[[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelNumberPad)],
self.numberToolbar.items = @[[[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelNumberPad)],
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
[[UIBarButtonItem alloc]initWithTitle:@"Master Credentials..." style:UIBarButtonItemStylePlain target:self action:@selector(fallback)],
[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
self.okButton];
}
else {
numberToolbar.items = @[[[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelNumberPad)],
self.numberToolbar.items = @[[[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelNumberPad)],
[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
self.okButton];
}

[numberToolbar sizeToFit];
self.textFieldPin.inputAccessoryView = numberToolbar;

[self validatePin];
[self.numberToolbar sizeToFit];
self.textFieldPin.inputAccessoryView = self.numberToolbar;
}


- (void)validatePin {
NSCharacterSet *numbersOnly = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
NSCharacterSet *characterSetFromTextField = [NSCharacterSet characterSetWithCharactersInString:self.textFieldPin.text];

self.okButton.enabled = self.textFieldPin.text.length > 3 && [numbersOnly isSupersetOfSet:characterSetFromTextField];
self.buttonOK.enabled = self.textFieldPin.text.length > 3 && [numbersOnly isSupersetOfSet:characterSetFromTextField];
}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

[self.textFieldPin becomeFirstResponder];
}

-(void)viewDidAppear:(BOOL)animated {
@@ -77,6 +87,21 @@ -(void)doneWithNumberPad{
self.onDone(kOk, self.textFieldPin.text);
}

- (IBAction)onOK:(id)sender {
[self.textFieldPin resignFirstResponder];
self.onDone(kOk, self.textFieldPin.text);
}

- (IBAction)onCancel:(id)sender {
[self.textFieldPin resignFirstResponder];
self.onDone(kCancel, nil);
}

- (IBAction)onUseMasterCredentials:(id)sender {
[self.textFieldPin resignFirstResponder];
self.onDone(kFallback, nil);
}

- (IBAction)onEditPin:(id)sender {
[self validatePin];
}
Oops, something went wrong.

0 comments on commit 12343f6

Please sign in to comment.
You can’t perform that action at this time.