diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index 6d954ca1098..176b346d1fd 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -22,6 +22,7 @@ on: - 'main' - 'rc' - 'hotfix-rc-desktop' + - 'nathan/autofill-fix' paths: - 'apps/desktop/**' - 'libs/**' diff --git a/apps/desktop/desktop_native/core/src/ipc/mod.rs b/apps/desktop/desktop_native/core/src/ipc/mod.rs index 531aeaa0a0b..71b0c58341e 100644 --- a/apps/desktop/desktop_native/core/src/ipc/mod.rs +++ b/apps/desktop/desktop_native/core/src/ipc/mod.rs @@ -56,19 +56,19 @@ pub fn path(name: &str) -> std::path::PathBuf { .position(|c| c.as_os_str() == "Containers"); // If the app is sanboxed, we need to use the App Group directory - if let Some(position) = containers_position { - // We want to use App Groups in /Users//Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop, - // so we need to remove all the components after the user. We can use the previous position to do this. - while home.components().count() > position - 1 { - home.pop(); - } - - let tmp = home.join("Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop/tmp"); - - // The tmp directory might not exist, so create it - let _ = std::fs::create_dir_all(&tmp); - return tmp.join(format!("app.{name}")); + let position = containers_position.unwrap_or(4); + + // We want to use App Groups in /Users//Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop, + // so we need to remove all the components after the user. We can use the previous position to do this. + while home.components().count() > position - 1 { + home.pop(); } + + let tmp = home.join("Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop/tmp"); + + // The tmp directory might not exist, so create it + let _ = std::fs::create_dir_all(&tmp); + return tmp.join(format!("app.{name}")); } #[cfg(any(target_os = "linux", target_os = "macos"))] diff --git a/apps/desktop/macos/autofill-extension/CredentialProviderViewController.swift b/apps/desktop/macos/autofill-extension/CredentialProviderViewController.swift index 4288ca8f3fe..fbab1dd0ac3 100644 --- a/apps/desktop/macos/autofill-extension/CredentialProviderViewController.swift +++ b/apps/desktop/macos/autofill-extension/CredentialProviderViewController.swift @@ -151,16 +151,18 @@ class CredentialProviderViewController: ASCredentialProviderViewController { override func loadView() { let view = NSView() // Hide the native window since we only need the IPC connection - view.isHidden = true +// view.isHidden = true self.view = view } override func prepareInterfaceForExtensionConfiguration() { + logger.log("[autofill-extension] prepareInterfaceForExtensionConfiguration called") client.sendNativeStatus(key: "request-sync", value: "") self.extensionContext.completeExtensionConfigurationRequest() } override func provideCredentialWithoutUserInteraction(for credentialRequest: any ASCredentialRequest) { + logger.log("[autofill-extension] provideCredentialWithoutUserInteraction called \(credentialRequest.description)") let timeoutTimer = createTimer() if let request = credentialRequest as? ASPasskeyCredentialRequest { @@ -227,16 +229,14 @@ class CredentialProviderViewController: ASCredentialProviderViewController { logger.log("[autofill-extension] provideCredentialWithoutUserInteraction2 called wrong") self.extensionContext.cancelRequest(withError: BitwardenError.Internal("Invalid authentication request")) } - - /* - Implement this method if provideCredentialWithoutUserInteraction(for:) can fail with - ASExtensionError.userInteractionRequired. In this case, the system may present your extension's - UI and call this method. Show appropriate UI for authenticating the user then provide the password - by completing the extension request with the associated ASPasswordCredential. - + +// Implement this method if provideCredentialWithoutUserInteraction(for:) can fail with +// ASExtensionError.userInteractionRequired. In this case, the system may present your extension's +// UI and call this method. Show appropriate UI for authenticating the user then provide the password +// by completing the extension request with the associated ASPasswordCredential. override func prepareInterfaceToProvideCredential(for credentialIdentity: ASPasswordCredentialIdentity) { + logger.log("[autofill-extension] prepareInterfaceToProvideCredential called \(credentialIdentity)") } - */ private func createTimer() -> DispatchWorkItem { // Create a timer for 600 second timeout diff --git a/apps/desktop/macos/autofill-extension/autofill_extension.entitlements b/apps/desktop/macos/autofill-extension/autofill_extension.entitlements index 86c7195768e..986d7501f49 100644 --- a/apps/desktop/macos/autofill-extension/autofill_extension.entitlements +++ b/apps/desktop/macos/autofill-extension/autofill_extension.entitlements @@ -2,11 +2,11 @@ - com.apple.developer.authentication-services.autofill-credential-provider - - com.apple.security.app-sandbox - - com.apple.security.application-groups + com.apple.developer.authentication-services.autofill-credential-provider + + com.apple.security.app-sandbox + + com.apple.security.application-groups LTZ2PFU5D6.com.bitwarden.desktop diff --git a/apps/desktop/resources/entitlements.mac.plist b/apps/desktop/resources/entitlements.mac.plist index fe49256d71c..afbd831cdff 100644 --- a/apps/desktop/resources/entitlements.mac.plist +++ b/apps/desktop/resources/entitlements.mac.plist @@ -10,5 +10,9 @@ com.apple.security.cs.allow-jit + com.apple.security.application-groups + + LTZ2PFU5D6.com.bitwarden.desktop +