diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 20305d96..f263fbf6 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -187,8 +187,8 @@ 4C7B63771C0CB51F00D7038C /* TTTStringTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B63701C0CB51F00D7038C /* TTTStringTransformers.m */; }; 4C7B637C1C0CB55600D7038C /* KeePassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7B63791C0CB55600D7038C /* KeePassKit.framework */; }; 4C7B637D1C0CB55600D7038C /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; }; - 4C7B637F1C0CB57300D7038C /* KeePassKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B63791C0CB55600D7038C /* KeePassKit.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 4C7B63801C0CB57300D7038C /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 4C7B637F1C0CB57300D7038C /* KeePassKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B63791C0CB55600D7038C /* KeePassKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 4C7B63801C0CB57300D7038C /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4C7BD07619FE94C900C7AA5C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BD07519FE94C900C7AA5C /* Assets.xcassets */; }; 4C7F8B681A10B68400CCB83D /* WelcomeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C7F8B6A1A10B68400CCB83D /* WelcomeView.xib */; }; 4C80304A1E2FBAA300133E4C /* MPTestKeyMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8030491E2FBAA300133E4C /* MPTestKeyMapper.m */; }; @@ -250,7 +250,7 @@ 4CD2B9061849424B0051B395 /* MPAutotypeContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD2B9051849424B0051B395 /* MPAutotypeContext.m */; }; 4CD4EE131FC7284000EA6EB3 /* MPPickcharsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD4EE111FC7284000EA6EB3 /* MPPickcharsViewController.m */; }; 4CD5D705177A5F3300100649 /* MPDatabaseSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD5D704177A5F3300100649 /* MPDatabaseSettingsWindowController.m */; }; - 4CD60C131C104AD4005BE5F8 /* HNHUi.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4CC281881C0F675B00B9174D /* HNHUi.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 4CD60C131C104AD4005BE5F8 /* HNHUi.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4CC281881C0F675B00B9174D /* HNHUi.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4CD7223B17A7CB0700F5A1E1 /* MPWorkflowPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7223A17A7CB0700F5A1E1 /* MPWorkflowPreferencesController.m */; }; 4CD78ABC16D155FF00768A1D /* 07_NotepadTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78AB716D155FF00768A1D /* 07_NotepadTemplate.pdf */; }; 4CD78ABD16D155FF00768A1D /* 08_SocketTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78AB816D155FF00768A1D /* 08_SocketTemplate.pdf */; }; @@ -1814,7 +1814,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = MP; - LastUpgradeCheck = 1030; + LastUpgradeCheck = 1130; ORGANIZATIONNAME = "HicknHack Software GmbH"; TargetAttributes = { 4C77E36115B84A240093A587 = { @@ -2876,6 +2876,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = MacPassAppIcon; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = ""; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = "${CURRENT_PROJECT_VERSION}"; @@ -2906,6 +2907,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = MacPassAppIcon; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = ""; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = "${CURRENT_PROJECT_VERSION}"; diff --git a/MacPass.xcodeproj/xcshareddata/xcschemes/MacPass.xcscheme b/MacPass.xcodeproj/xcshareddata/xcschemes/MacPass.xcscheme index 2fe0b176..f693d37d 100644 --- a/MacPass.xcodeproj/xcshareddata/xcschemes/MacPass.xcscheme +++ b/MacPass.xcodeproj/xcshareddata/xcschemes/MacPass.xcscheme @@ -1,6 +1,6 @@ - - - - - - + shouldUseLaunchSchemeArgsEnv = "NO" + codeCoverageEnabled = "YES"> - - + + + + + + - - - + - + @@ -27,7 +27,7 @@ - + @@ -35,7 +35,7 @@ - + MacPass will send key press events to the system when Autotype or Global Autotype is executed. Since macOS 10.14 Mojave this is only possible, if Accessibility permissions are granted to the application. @@ -44,7 +44,7 @@ - + - + MacPass will read every window title when Global Autotype is executed to find a match. Since macOS 10.15 Catalina it is not possible to read any window title, if the user has not granted permissions to record the screen. If you are running macOS 10.15 or higher, MacPass will check if it can read every window title of currently visible windows. This test will not read the actual title. The titles aren't stored or processed in any way. @@ -67,7 +67,7 @@ - + @@ -75,10 +75,10 @@ - + - + To request Screen Recording permissions, MacPass will try to capture a 1 by 1 Pixel sized screenshot of the top left part of your screen. The data is not stored nor processed in any way. @@ -97,7 +97,7 @@ - + - + @@ -89,14 +90,14 @@ - + @@ -130,21 +131,21 @@ - + Disabling this compromises security. If enabled, anything copied to the Clipboard in MacPass will be available on your connected iOS devices. You should clear the clipboard on those devices manually. @@ -152,20 +153,30 @@ + + + - + - + + @@ -197,27 +208,27 @@ - + - + - + @@ -225,7 +236,7 @@ - + @@ -233,10 +244,10 @@ - + - + @@ -273,7 +284,7 @@ - + diff --git a/MacPass/Base.lproj/ReferenceBuilderView.xib b/MacPass/Base.lproj/ReferenceBuilderView.xib index 4adb2a9c..d284d117 100644 --- a/MacPass/Base.lproj/ReferenceBuilderView.xib +++ b/MacPass/Base.lproj/ReferenceBuilderView.xib @@ -1,8 +1,8 @@ - + - + @@ -18,11 +18,11 @@ - + - + @@ -37,7 +37,7 @@ - + @@ -48,14 +48,14 @@ - + @@ -63,7 +63,7 @@ - + @@ -71,10 +71,10 @@ - + - + @@ -88,7 +88,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -104,7 +104,7 @@ - + diff --git a/MacPass/Base.lproj/UpdatePreferences.xib b/MacPass/Base.lproj/UpdatePreferences.xib index 2fa4ab20..410ca3c6 100644 --- a/MacPass/Base.lproj/UpdatePreferences.xib +++ b/MacPass/Base.lproj/UpdatePreferences.xib @@ -1,8 +1,8 @@ - + - + @@ -32,7 +32,7 @@ - + @@ -46,7 +46,7 @@ - + diff --git a/MacPass/Base.lproj/WorkflowPreferences.xib b/MacPass/Base.lproj/WorkflowPreferences.xib index 66372731..004c137a 100644 --- a/MacPass/Base.lproj/WorkflowPreferences.xib +++ b/MacPass/Base.lproj/WorkflowPreferences.xib @@ -1,8 +1,8 @@ - + - + @@ -19,16 +19,16 @@ - + - + - + - + @@ -36,10 +36,10 @@ - + - + @@ -49,7 +49,7 @@ - + @@ -57,10 +57,10 @@ - + - + @@ -90,10 +90,10 @@ - + - + @@ -104,7 +104,7 @@ - + diff --git a/MacPass/MPGeneralPreferencesController.h b/MacPass/MPGeneralPreferencesController.h index f216249b..d55a6ca8 100644 --- a/MacPass/MPGeneralPreferencesController.h +++ b/MacPass/MPGeneralPreferencesController.h @@ -32,6 +32,7 @@ @property (strong) IBOutlet NSPopUpButton *idleTimeOutPopup; @property (strong) IBOutlet NSButton *lockOnSleepCheckButton; @property (strong) IBOutlet NSButton *lockOnLogoutCheckButton; +@property (strong) IBOutlet NSButton *lockOnScreenSleepCheckButton; @property (strong) IBOutlet NSButton *reopenLastDatabase; @property (strong) IBOutlet NSButton *enableAutosaveCheckButton; @property (strong) IBOutlet NSButton *rememberKeyFileCheckButton; diff --git a/MacPass/MPGeneralPreferencesController.m b/MacPass/MPGeneralPreferencesController.m index 20428a82..759e4132 100644 --- a/MacPass/MPGeneralPreferencesController.m +++ b/MacPass/MPGeneralPreferencesController.m @@ -50,6 +50,7 @@ [self.preventUniversalClipboardSupportCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyPreventUniversalClipboard] options:nil]; [self.lockOnSleepCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLockOnSleep] options:nil]; [self.lockOnLogoutCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingskeyLockOnLogout] options:nil]; + [self.lockOnScreenSleepCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingskeyLockOnScreenSleep] options:nil]; [self.idleTimeOutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyIdleLockTimeOut] options:nil]; [self.reopenLastDatabase bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch] options:nil]; [self.enableAutosaveCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableAutosave] options:nil]; diff --git a/MacPass/MPLockDaemon.m b/MacPass/MPLockDaemon.m index 5180f37d..8851198c 100644 --- a/MacPass/MPLockDaemon.m +++ b/MacPass/MPLockDaemon.m @@ -28,6 +28,7 @@ @property (nonatomic,assign) BOOL lockOnSleep; @property (nonatomic,assign) BOOL lockOnLogout; +@property (nonatomic,assign) BOOL lockOnScreenSleep; @property (nonatomic,assign) NSUInteger idleLockTime; @property (nonatomic,strong) id localEventHandler; @property (nonatomic,strong) NSTimer *idleCheckTimer; @@ -59,6 +60,7 @@ static MPLockDaemon *_sharedInstance; [self bind:NSStringFromSelector(@selector(lockOnSleep)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLockOnSleep] options:nil]; [self bind:NSStringFromSelector(@selector(idleLockTime)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyIdleLockTimeOut] options:nil]; [self bind:NSStringFromSelector(@selector(lockOnLogout)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingskeyLockOnLogout] options:nil]; + [self bind:NSStringFromSelector(@selector(lockOnScreenSleep)) toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingskeyLockOnScreenSleep] options:nil]; } return self; } @@ -95,6 +97,18 @@ static MPLockDaemon *_sharedInstance; } } +- (void)setLockOnScreenSleep:(BOOL)lockOnScreenSleep { + if(_lockOnScreenSleep != lockOnScreenSleep) { + _lockOnScreenSleep = lockOnScreenSleep; + if(_lockOnScreenSleep) { + [NSWorkspace.sharedWorkspace.notificationCenter addObserver:self selector:@selector(_willScreenSleepNotification:) name:NSWorkspaceScreensDidSleepNotification object:nil]; + } + else { + [NSWorkspace.sharedWorkspace.notificationCenter removeObserver:self name:NSWorkspaceScreensDidSleepNotification object:nil]; + } + } +} + - (void)setIdleLockTime:(NSUInteger)idleLockTime { if(_idleLockTime != idleLockTime) { _idleLockTime = idleLockTime; @@ -113,6 +127,9 @@ static MPLockDaemon *_sharedInstance; - (void)_willSleepNotification:(NSNotification *)notification { [((MPAppDelegate *)NSApp.delegate) lockAllDocuments]; } +- (void)_willScreenSleepNotification:(NSNotification *)notification { + [((MPAppDelegate *)NSApp.delegate) lockAllDocuments]; +} - (void)_checkIdleTime:(NSTimer *)timer { if(timer != self.idleCheckTimer) { diff --git a/MacPass/MPSettingsHelper.h b/MacPass/MPSettingsHelper.h index 9c366a87..786b8b17 100644 --- a/MacPass/MPSettingsHelper.h +++ b/MacPass/MPSettingsHelper.h @@ -42,6 +42,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyBrowserBundleId; APPKIT_EXTERN NSString *const kMPSettingsKeyLockOnSleep; APPKIT_EXTERN NSString *const kMPSettingskeyLockOnLogout; APPKIT_EXTERN NSString *const kMPSettingsKeyIdleLockTimeOut; +APPKIT_EXTERN NSString *const kMPSettingskeyLockOnScreenSleep; /* Autosaving states */ APPKIT_EXTERN NSString *const kMPSettingsKeyShowInspector; diff --git a/MacPass/MPSettingsHelper.m b/MacPass/MPSettingsHelper.m index 63dea553..c08a4876 100644 --- a/MacPass/MPSettingsHelper.m +++ b/MacPass/MPSettingsHelper.m @@ -37,6 +37,7 @@ NSString *const kMPSettingsKeyFileChangeStrategy = @"FileCh NSString *const kMPSettingsKeyEnableAutosave = @"EnableAutosave"; NSString *const kMPSettingsKeyLockOnSleep = @"LockOnSleep"; NSString *const kMPSettingskeyLockOnLogout = @"LockOnLogout"; +NSString *const kMPSettingskeyLockOnScreenSleep = @"LockOnScreenSleep"; NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut"; NSString *const kMPSettingsKeyShowInspector = @"ShowInspector"; NSString *const kMPSettingsKeyEntryTableSortDescriptors = @"EntryTableSortDescriptors"; @@ -132,6 +133,7 @@ NSString *const kMPDepricatedSettingsKeyAutotypeHideAccessibiltyWarning = @"Au kMPSettingsKeyFileChangeStrategy: @(MPFileChangeStrategyAsk), // Ask what to do on a file change! kMPSettingsKeyLockOnSleep: @YES, kMPSettingskeyLockOnLogout: @NO, + kMPSettingskeyLockOnScreenSleep: @NO, kMPSettingsKeyIdleLockTimeOut: @0, // 5 minutes kMPSettingsKeyLegacyHideNotes: @NO, kMPSettingsKeyLegacyHidePassword: @YES, diff --git a/MacPass/MPTemporaryFileStorage.m b/MacPass/MPTemporaryFileStorage.m index 732e2d07..fb890b2e 100644 --- a/MacPass/MPTemporaryFileStorage.m +++ b/MacPass/MPTemporaryFileStorage.m @@ -102,7 +102,18 @@ return NO; } NSString *fileName = [NSString stringWithFormat:@"%@_%@", NSProcessInfo.processInfo.globallyUniqueString, binary.name]; - self.temporaryFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:fileName]]; + + NSURL *userDesktop = [NSFileManager.defaultManager URLsForDirectory:NSDesktopDirectory inDomains:NSUserDomainMask].firstObject; + if(!userDesktop) { + return NO; + } + NSError *error; + NSURL *tempURL = [NSFileManager.defaultManager URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask appropriateForURL:userDesktop create:YES error:&error]; + if(!tempURL) { + NSLog(@"Unable to create temporary directory for file preview: %@", error.description); + return NO; + } + self.temporaryFileURL = [tempURL URLByAppendingPathComponent:fileName isDirectory:NO]; BOOL success = [binary.data writeToURL:self.temporaryFileURL options:0 error:0]; if(!success) {