Repository navigation
Conversation
WalkthroughThe pull request introduces significant updates to the Cryptomator application's keychain management, focusing on integrating Windows Hello and enhancing macOS keychain migration functionalities. Key changes include:
These changes collectively introduce a new system property, Possibly related PRs
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Adresses #2180. |
|
I wonder whether this implementation does suffice from the security point of view. You can enable Touch ID on capable devices, which unlocks vaults only after the fingerprint was provided, but this feature can be disabled in the prefs. Maybe only allow to disable Touch ID via a successful Touch ID authentication? Discussion welcome! Edit: added some more thoughts. |
|
I'm wondering if we should "just" refactor org_cryptomator_macos_keychain_MacKeychain_Native.m from the deprecated SecKeychain API to the "new" SecItem API. With With that, I don't think we even need a new "two-factor" API because these APIs will take care of the Touch ID prompts. And also make sure that the password is only accessible via Touch ID. I believe this is the "most secure" way instead of splitting up saving the password and prompting for Touch ID. What do you think? |
I would support this, however I am wondering if items stores with the old API are accessible from the new one. It is certainly more secure to let the OS combine authentication and secret storage instead of triggering biometric authentication ourselves without it being really required in order to access stored secrets. |
It could be possible. If I'm understanding TN3137 correctly, all these different keychain APIs target the same file-based keychain. The new API can also target the data protection keychain (which is recommended but not the default yet). If it doesn't work, we could migrate the keychain entries. All in all, this would require some experimentation. |
@tobihagemann @overheadhunter I raise my hand and take care of it. I already started implementing the Objective-C code. |
|
Thank you! 🙇♂️ Just a quick tip: I'm willing to raise the minimum version to 10.13.4 (currently, it's 10.13), so that you don't have to do if/else logic for this feature. |
|
Thank you @tobihagemann, that's a good advice! |
|
Despite the impl being in ObjC, if the API is C compatible, we could use Panama :) |
This comment was marked as outdated.
This comment was marked as outdated.
|
Writing the code was no problem, but I got stuck with configuring Xcode the right way. Googling for hours did not help. What's the problem? The code seems to work. Reading "old" keychain items that were created before without 10:16:55.905 [App Background Thread 002] ERROR o.c.ui.keyloading.KeyLoadingStrategy - Failed to store passphrase in system keychain.
org.cryptomator.integrations.keychain.KeychainAccessException: Failed to store password. Error code -34018
at org.cryptomator.integrations.mac@1.3.0-SNAPSHOT/org.cryptomator.macos.keychain.MacSystemKeychainAccess.storePassphrase(MacSystemKeychainAccess.java:43)
at org.cryptomator.desktop/org.cryptomator.common.keychain.KeychainManager.storePassphrase(KeychainManager.java:48)
at org.cryptomator.desktop/org.cryptomator.ui.keyloading.masterkeyfile.MasterkeyFileLoadingStrategy.savePasswordToSystemkeychain(MasterkeyFileLoadingStrategy.java:117)
at org.cryptomator.desktop/org.cryptomator.ui.keyloading.masterkeyfile.MasterkeyFileLoadingStrategy.cleanup(MasterkeyFileLoadingStrategy.java:107)
at org.cryptomator.desktop/org.cryptomator.ui.keyloading.KeyLoadingStrategy.use(KeyLoadingStrategy.java:89)
at org.cryptomator.desktop/org.cryptomator.ui.unlock.UnlockWorkflow.call(UnlockWorkflow.java:70)
at org.cryptomator.desktop/org.cryptomator.ui.unlock.UnlockWorkflow.call(UnlockWorkflow.java:31)
at javafx.graphics/javafx.concurrent.Task$TaskCallable.call(Task.java:1399)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718)
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
10:16:55.906 [JavaFX Application Thread] INFO o.c.ui.unlock.UnlockWorkflow - Unlock of 'Test' succeeded.Error code But: where to configure this for a library? The Xcode library code project does not have the "Signing & Capabilities" tab (picture). Are there Xcode cracks around, @tobihagemann maybe? 😄 EDIT: configuring this for a library is the wrong approach, see #3311 (comment) below. |
This comment was marked as outdated.
This comment was marked as outdated.
|
Yeah, code signing is no fun. 😅 We are enrolled in the Apple Developer program, but we can't share the certificate publicly. To be honest, I don't even know what we should do exactly. Cryptomator, the main app, doesn't have any code signing set up for development. It will only be code signed during distribution. I have the feeling, even with the certificate installed, I have to build the app and can't test this by running it in the IDE. Apart from that: Total Java noob here, but I've looked through your commits and the native integration seems totally different from the rest. Did we use JNI in the past and you're now using JNA? I'm just wondering if this is necessary. It seems like that we would then distribute two |
Yeah, nobody should share her certificate, that's for sure and that wasn't my intention, of course. I know, that Cryptomator uses the certificate for signing for distribution, not before. Unfortunately, if we want to use the new What I asked for is to take the ready to compile code from this branch and use it as a dependency for Cryptomator run in an IDE on Mac. As the code contains me as the "Development team" (
Yes, it's two libs. For the question on why JNA and not Panama, please see my #3311 (comment) before. But you mentioned JNI. This requires C code and someone would need to write it. I am not capable of doing that. 🤷🏻♂️ |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
While still working on Touch ID support, I'd like to offer the tested and mature code so far to replace the deprecated |
|
I ruled out the Error code The correct entitlement for accessing data protection keychain items is the following: <key>keychain-access-groups</key>
<array/>In addition to that, we need a provisioning profile: In contrast, restricted entitlements must be authorized by a provisioning profile. This is an important security feature on macOS. For example, the fact that the keychain-access-groups entitlement must be authorized by a profile means that other developers can’t impersonate your app in order to steal its keychain items. macOS expects to find the profile at Finally, the Cryptomator entitlements need to match the entitlements in the provisioning profile, namely the keys index 22d0f6954d..178c0fc974 100644
--- a/dist/mac/Cryptomator.entitlements
+++ b/dist/mac/Cryptomator.entitlements
@@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>com.apple.application-identifier</key>
+ <string>XXXXXXXXXX.net.plawetzki.cryptomator</string>
+ <key>com.apple.developer.team-identifier</key>
+ <string>XXXXXXXXXX</string>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>The former needs to match the App ID in the provisioning profile:
|
|
Thank you for the info, @purejava. Took me some time to look into it, sorry for that. I did the "risky" thing and just pushed something in In order to build the application locally, you have to put the provisioning profile in In the CI build, I've made the adjustments that the provisioning profile (decoded as base64) and team identifier are saved as secret variables. And I've also added an entry to the Does that all make sense? 😄 |
You are welcome @tobihagemann. Absolutely no need to worry - I am glad that you could look into it!
I looked through your change and yes: that's the way it should be done, from the DevOps point of view as well as from the security point of view. I've read too, that the profile should not be committed and kept secret, but you are right: it's part of the final app. 🤷🏻
Yes, I saw that in your code.
Yes, I saw that in your code too.
I think we need to test that. Meanwhile I noticed, that a different group is used in the iOS app. Creating a vault on iOS and open it on macOS and vice versa should be a good starting point.
That all makes perfectly sense! 😄 # codesign
if [ -n "${CODESIGN_IDENTITY}" ]; then
+ echo "Codesigning jdk files..."
+ find ${APP_NAME}.app/Contents/runtime/Contents/Home/lib/ -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
+ find ${APP_NAME}.app/Contents/runtime/Contents/Home/lib/ -name 'jspawnhelper' -exec codesign --force -o runtime -s ${CODESIGN_IDENTITY} {} \;
+ echo "Codesigning jar contents..."
find ${APP_NAME}.app/Contents/runtime/Contents/MacOS -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
for JAR_PATH in `find ${APP_NAME}.app -name "*.jar"`; do
if [[ `unzip -l ${JAR_PATH} | grep '.dylib\|.jnilib'` ]]; then |
|
Ah, thanks, fixed in d60ced5. Probably never noticed it because I use Temurin locally and I believe we had to make the changes when we switched to Zulu in the CI builds (I don't know why) or for whatever different reason.
I don't think that we need to test that scenario. The keychain access group on iOS is used to share data between the host application and the app extensions (file provider and file provider UI). Since we don't make the keychain entries "synchronizable" ( |
Good. When it's already decided, that the keychain entries won't be "synchronizable" for now, we can keep the entitlements as they are. |
There was a problem hiding this comment.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (2)
src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java (2)
3-3: Remove unused import.The import
org.apache.commons.lang3.SystemUtilsis not used in the current file.- import org.apache.commons.lang3.SystemUtils;
54-62: Clarify the TODO comment and improve code readability.The TODO comment should be more specific about what needs to be adjusted. Additionally, consider improving the readability of the conditional block by using a single line for setting the visibility property.
- // ToDo Remove or adjust, as soon as there are implementations for integrations-api - // KeychainAccessProvider:storePassphraseForAuthenticatedUser for other OSes + // TODO: Remove or adjust when implementations for integrations-api KeychainAccessProvider:storePassphraseForAuthenticatedUser are available for other OSes. if (!SystemUtils.IS_OS_MAC) { - needAuthenticatedUserCheckbox.visibleProperty().set(false); + needAuthenticatedUserCheckbox.setVisible(false); }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- pom.xml (1 hunks)
- src/main/java/org/cryptomator/common/keychain/KeychainManager.java (1 hunks)
- src/main/java/org/cryptomator/common/settings/VaultSettings.java (5 hunks)
- src/main/java/org/cryptomator/common/settings/VaultSettingsJson.java (1 hunks)
- src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java (1 hunks)
- src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java (4 hunks)
- src/main/resources/fxml/vault_options_masterkey.fxml (2 hunks)
- src/main/resources/i18n/strings.properties (1 hunks)
- src/test/java/org/cryptomator/common/keychain/MapKeychainAccess.java (1 hunks)
Files skipped from review due to trivial changes (1)
- src/main/resources/i18n/strings.properties
Additional comments not posted (15)
src/test/java/org/cryptomator/common/keychain/MapKeychainAccess.java (1)
31-34: LGTM!The method
storePassphraseForAuthenticatedUseris a straightforward delegation to the existingstorePassphrasemethod, enhancing code clarity.src/main/resources/fxml/vault_options_masterkey.fxml (1)
34-36: LGTM!The new
CheckBoxelement withfx:id="needAuthenticatedUserCheckbox"is well-integrated into the existing layout.src/main/java/org/cryptomator/common/settings/VaultSettingsJson.java (1)
68-69: LGTM!The new boolean field
needAuthenticatedUseris correctly annotated with@JsonPropertyand initialized with a default value.src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java (1)
33-33: Ensure the newCheckBoxproperty is initialized.The
needAuthenticatedUserCheckboxproperty is declared but not initialized. Ensure it is properly initialized in the FXML file.Verification successful
Let's expand the search to include all file types and refine the search pattern to ensure we capture any initialization of the
needAuthenticatedUserCheckbox.
The
needAuthenticatedUserCheckboxis properly initialized.The
needAuthenticatedUserCheckboxis declared in theMasterkeyOptionsController.javafile and initialized in thevault_options_masterkey.fxmlfile as follows:
src/main/resources/fxml/vault_options_masterkey.fxml:<CheckBox text="%vaultOptions.masterkey.needAuthenticatedUser" fx:id="needAuthenticatedUserCheckbox"/>Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `needAuthenticatedUserCheckbox` is properly initialized in the FXML file. # Test: Search for the `needAuthenticatedUserCheckbox` in the FXML file. Expect: The checkbox should be declared and initialized. rg --type xml 'needAuthenticatedUserCheckbox'Length of output: 45
Script:
#!/bin/bash # Description: Verify that the `needAuthenticatedUserCheckbox` is properly initialized in the codebase. # Test: Search for the `needAuthenticatedUserCheckbox` in all files. Expect: The checkbox should be declared and initialized. rg 'needAuthenticatedUserCheckbox'Length of output: 1027
src/main/java/org/cryptomator/common/keychain/KeychainManager.java (1)
53-56: Ensure proper exception handling.The new method
storePassphraseForAuthenticatedUsercorrectly throwsKeychainAccessException. Ensure that this method is called in contexts where this exception is properly handled.Verification successful
Proper exception handling is implemented.
The method
storePassphraseForAuthenticatedUseris correctly wrapped in try-catch blocks that handleKeychainAccessExceptionin bothMasterkeyOptionsController.javaandMasterkeyFileLoadingStrategy.java.
src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.javasrc/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.javaScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `storePassphraseForAuthenticatedUser` method is called in contexts where `KeychainAccessException` is properly handled. # Test: Search for the method usage. Expect: The method should be called in contexts where `KeychainAccessException` is properly handled. rg --type java 'storePassphraseForAuthenticatedUser'Length of output: 1122
Script:
#!/bin/bash # Description: Verify that the `storePassphraseForAuthenticatedUser` method is called in contexts where `KeychainAccessException` is properly handled. # Check for exception handling in MasterkeyOptionsController.java rg -A 5 'storePassphraseForAuthenticatedUser' src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java # Check for exception handling in MasterkeyFileLoadingStrategy.java rg -A 5 'storePassphraseForAuthenticatedUser' src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.javaLength of output: 1007
src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java (1)
117-121: Verify the conditional logic for storing passphrases.The conditional logic for storing passphrases based on the vault's settings looks correct. Ensure that the
needAuthenticatedUsersetting is properly initialized and used.Verification successful
The conditional logic for storing passphrases based on the vault's settings is correct.
The
needAuthenticatedUsersetting is properly initialized and used across the codebase.
VaultSettings.java: InitializationVaultSettingsJson.java: Serialization/DeserializationMasterkeyOptionsController.java: UI Binding and Event HandlingMasterkeyFileLoadingStrategy.java: Conditional LogicScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `needAuthenticatedUser` setting is properly initialized and used. # Test: Search for the initialization and usage of `needAuthenticatedUser`. Expect: The setting should be properly initialized and used. rg --type java 'needAuthenticatedUser'Length of output: 2147
src/main/java/org/cryptomator/common/settings/VaultSettings.java (5)
43-43: LGTM! Added constant for default authenticated user requirement.The new constant
DEFAULT_NEED_AUTHENTICATED_USERis appropriately added with a default value offalse.
62-62: LGTM! Added property for authenticated user requirement.The new property
needAuthenticatedUseris appropriately added to theVaultSettingsclass.
89-89: LGTM! Initialized authenticated user requirement property in constructor.The
needAuthenticatedUserproperty is correctly initialized in the constructor using the value from theVaultSettingsJsonobject.
105-105: LGTM! Included authenticated user requirement property in observables.The
needAuthenticatedUserproperty is correctly included in the array of observables returned by theobservablesmethod.
136-136: LGTM! Included authenticated user requirement property in serialized output.The
needAuthenticatedUserproperty is correctly included in the serialized output of theVaultSettingsclass.pom.xml (4)
37-37: LGTM! Updated Cryptomator integrations version.The version is updated from
1.3.1to1.4.0-SNAPSHOT, likely including new features or bug fixes.
38-38: LGTM! Updated Windows integrations version.The version is updated from
1.2.5to1.3.0-SNAPSHOT, likely including new features or bug fixes.
39-39: LGTM! Updated macOS integrations version.The version is updated from
1.2.4to1.3.0-SNAPSHOT, likely including new features or bug fixes.
40-40: LGTM! Updated Linux integrations version.The version is updated from
1.4.5to1.5.0-SNAPSHOT, likely including new features or bug fixes.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java
This is ready for review, and I'd like to request a review from someone, who finds the time, maybe @tobihagemann, @overheadhunter, ... 😄. It took me a while to figure out, on how to minimize the amount of Touch ID pop-ups that come up on unlocking a vault. After implementing this, four succeeding Touch ID pop-ups had to overcome: check_if_passphrase_is_stored, load the passphrase, load it again to update it and update it. This can be done be reusing This PR is intended to solve #2180, which includes two requirements:
As the first bullet point is already implemented in the app with the normal keychain functionality, it is not possible to do so without providing a password. The whole concept of the app is designed around a password that protects a vault. Design
Features
Maintenance
Thanks. |
|
Thank you! have some questions based on your description. I must admit that I didn't test it yet and wasn't able to figure it out by looking at the code, so I'll just ask:
And I'd suggest to use the term "Touch ID" in the UI on macOS, so that users instantly know what the new setting is about. |
|
All done @infeo. This is a working implementation for Windows Hello and Touch ID on Mac. |
* integrations-win to 1.4.0 * integrations-mac to 1.3.0
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java (1)
115-121: Consider adding biometric authentication retry logic.For a better user experience with Touch ID/Windows Hello, consider implementing retry logic when biometric authentication fails.
Example implementation:
try { if (keychain.isSupported() && !keychain.isPassphraseStored(vault.getId())) { + int maxRetries = 3; + int attempts = 0; + KeychainAccessException lastException = null; + while (attempts < maxRetries) { try { keychain.storePassphrase(vault.getId(), vault.getDisplayName(), passphrase, vault.getVaultSettings().needAuthenticatedUser.get()); + break; } catch (KeychainAccessException e) { + lastException = e; + if (e.getMessage().contains("authentication")) { + attempts++; + if (attempts < maxRetries) { + LOG.info("Biometric authentication failed, attempt {}/{}", attempts, maxRetries); + Thread.sleep(1000); // Brief delay before retry + continue; + } + } + throw e; } + } + if (lastException != null) { + throw lastException; + } } } catch (KeychainAccessException e) { LOG.error("Failed to store passphrase in system keychain.", e); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pom.xml(1 hunks)src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java(1 hunks)
🔇 Additional comments (4)
pom.xml (1)
38-39: Version updates align with biometric authentication features.The version updates for Windows (1.4.0) and macOS (1.3.0) integrations correspond to the addition of Windows Hello and Touch ID support respectively.
Let's verify these versions are published and check for any security advisories:
Suggestion: Consider adding a comment in the properties section documenting the security-related changes in these versions:
<!-- cryptomator dependencies --> <cryptomator.cryptofs.version>2.7.1</cryptomator.cryptofs.version> <cryptomator.integrations.version>1.4.0</cryptomator.integrations.version> +<!-- Windows Hello support added in 1.4.0 --> <cryptomator.integrations.win.version>1.4.0</cryptomator.integrations.win.version> +<!-- Touch ID support added in 1.3.0 --> <cryptomator.integrations.mac.version>1.3.0</cryptomator.integrations.mac.version>✅ Verification successful
✓ Dependencies verified: versions exist and no security advisories found
Both Windows (1.4.0) and macOS (1.3.0) integration versions are published in Maven Central and have no reported security vulnerabilities.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the published versions and security status of the integration dependencies # Check if the Windows integration version exists in Maven Central echo "Checking Windows integration version..." curl -s "https://search.maven.org/solrsearch/select?q=g:org.cryptomator+AND+a:integrations-win+AND+v:1.4.0" | jq '.response.numFound' # Check if the macOS integration version exists in Maven Central echo "Checking macOS integration version..." curl -s "https://search.maven.org/solrsearch/select?q=g:org.cryptomator+AND+a:integrations-mac+AND+v:1.3.0" | jq '.response.numFound' # Check for security advisories echo "Checking for security advisories..." gh api graphql -f query=' { securityVulnerabilities(first: 5, ecosystem: MAVEN, package: "org.cryptomator:integrations-win") { nodes { advisory { summary severity publishedAt } vulnerableVersionRange firstPatchedVersion { identifier } } } }' gh api graphql -f query=' { securityVulnerabilities(first: 5, ecosystem: MAVEN, package: "org.cryptomator:integrations-mac") { nodes { advisory { summary severity publishedAt } vulnerableVersionRange firstPatchedVersion { identifier } } } }'Length of output: 1261
src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java (3)
115-119: Add authentication validation before storing passphrase.While the code correctly checks if the keychain is supported, it should verify that the user is authenticated before attempting to store the passphrase, especially when Touch ID is enabled.
Run this script to check for other instances where authentication validation might be missing:
#!/bin/bash # Search for keychain storage calls without authentication checks ast-grep --pattern 'storePassphrase($$$)'
119-121: Enhance error handling for authentication failures.The current error handling doesn't distinguish between different types of keychain access failures, which is particularly important for biometric authentication failures.
115-119:⚠️ Potential issueAdd missing authentication requirement for biometric validation.
The
storePassphrasecall is missing the authentication requirement parameter needed for Touch ID/Windows Hello support. This could bypass biometric authentication requirements.Apply this diff to restore the authentication requirement:
if (keychain.isSupported() && !keychain.isPassphraseStored(vault.getId())) { - keychain.storePassphrase(vault.getId(), vault.getDisplayName(), passphrase); + keychain.storePassphrase(vault.getId(), vault.getDisplayName(), passphrase, + vault.getVaultSettings().needAuthenticatedUser.get()); }Likely invalid or redundant comment.
(cherry picked from commit fc709eb)
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/mainwindow/VaultDetailLockedController.java (1)
33-36: Consider adding error handling to the binding.The reactive binding implementation is a good improvement, but consider handling potential keychain access failures:
this.passwordSaved = Bindings.createBooleanBinding(() -> { var v = vault.get(); - return v != null && keychain.getPassphraseStoredProperty(v.getId()).getValue(); + try { + return v != null && keychain.getPassphraseStoredProperty(v.getId()).getValue(); + } catch (Exception e) { + logger.error("Failed to check keychain state", e); + return false; + } }, vault, keychain.getKeychainImplementation());
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
pom.xml(2 hunks)src/main/java/module-info.java(1 hunks)src/main/java/org/cryptomator/common/keychain/KeychainManager.java(6 hunks)src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java(1 hunks)src/main/java/org/cryptomator/ui/mainwindow/VaultDetailLockedController.java(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java
- src/main/java/org/cryptomator/common/keychain/KeychainManager.java
- pom.xml
🔇 Additional comments (5)
src/main/java/module-info.java (3)
54-54: Clarify the relevance of Caffeine to Touch ID implementation.The addition of Caffeine appears unrelated to the PR's main objective of adding Touch ID and Windows Hello support. Could you clarify why this caching library is needed as part of this implementation?
54-54: Verify build configuration for Caffeine dependency.The addition of Caffeine as a module dependency looks correct. However, ensure this dependency is properly declared in the build configuration file (e.g.,
pom.xmlorbuild.gradle).Run the following script to check the build configuration:
✅ Verification successful
Caffeine dependency is properly configured ✅
The Caffeine dependency is correctly declared in both the module descriptor (
module-info.java) and the Maven build configuration (pom.xml).🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if Caffeine dependency is properly declared in build files # Check Maven POM file if [ -f "pom.xml" ]; then echo "Checking Maven POM..." rg -A 3 "com\.github\.benmanes\.caffeine" pom.xml fi # Check Gradle build file if [ -f "build.gradle" ]; then echo "Checking Gradle build..." rg -A 3 "com\.github\.benmanes\.caffeine" build.gradle fiLength of output: 151
Script:
#!/bin/bash # Search for any Caffeine-related dependency declarations with broader patterns echo "Checking for Caffeine dependency with broader patterns..." rg -i "caffeine" pom.xml echo -e "\nChecking for parent POM references..." rg "<parent>" -A 5 pom.xml echo -e "\nLooking for other POM files..." fd "pom.xml$"Length of output: 479
54-54: Consider completing Guava to Caffeine transition.Since you're adding Caffeine as a caching solution, consider removing the Guava dependency (
requires com.google.common) if it's no longer needed. This would help avoid maintaining two caching libraries.Run the following script to check remaining Guava cache usage:
src/main/java/org/cryptomator/ui/mainwindow/VaultDetailLockedController.java (2)
11-11: LGTM! Good move towards reactive programming.The addition of the Bindings import supports the transition to a more reactive programming model using JavaFX bindings.
33-36: Verify security implications of the binding.Given that this PR implements biometric authentication support, we should verify that this binding:
- Respects the authentication state
- Doesn't expose keychain information before proper authentication
- Properly handles the keychain locked/unlocked state
Let's verify the security implications:
✅ Verification successful
Binding implementation follows security best practices
The binding is implemented securely:
- Only indicates password presence without exposing sensitive data
- Respects keychain locked state through proper authentication checks
- Updates appropriately with keychain implementation changes
- Actual password access requires separate authentication
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for authentication checks in KeychainManager ast-grep --pattern 'class KeychainManager { $$$ getPassphraseStoredProperty($_) { $$$ } $$$ }' # Look for related security checks rg -A 5 "kSecAccessControl|SecAccessControl|TouchID|WindowsHello"Length of output: 1417
Script:
#!/bin/bash # Find KeychainManager implementation fd -e java -x rg -l "class.*KeychainManager" # Look for biometric authentication related code rg -A 5 "biometric|authenticate|unlock.*keychain|isLocked" # Find all uses of getPassphraseStoredProperty rg -A 3 "getPassphraseStoredProperty" # Look for security state management ast-grep --pattern 'class $_ implements Keychain { $$$ }'Length of output: 12284
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/org/cryptomator/common/keychain/KeychainManager.java(6 hunks)src/test/java/org/cryptomator/common/keychain/KeychainManagerTest.java(2 hunks)
🔇 Additional comments (5)
src/test/java/org/cryptomator/common/keychain/KeychainManagerTest.java (2)
22-28: LGTM! Proper JavaFX initialization setup.The startup method correctly initializes the JavaFX platform with appropriate timeout and error handling.
38-38: Verify test coverage for new authentication parameter.The test case doesn't verify the new
requireOsAuthenticationparameter behavior introduced for Touch ID/Windows Hello support.Consider adding test cases to verify:
- Authentication requirement when storing passwords
- Different behavior when
requireOsAuthenticationis true vs falseAlso applies to: 46-46
src/main/java/org/cryptomator/common/keychain/KeychainManager.java (3)
3-3: Consider security implications of soft references.The switch from Guava's weak references to Caffeine's soft references could potentially keep sensitive data in memory longer than necessary.
Consider:
- Using weak references instead of soft references for sensitive data
- Adding explicit cleanup mechanisms
Also applies to: 26-28
109-113: LGTM! Proper thread-safe property updates.The implementation correctly handles property updates on the JavaFX application thread.
140-142: Review necessity of exposing keychain implementation.Exposing the internal keychain implementation could lead to security vulnerabilities if misused.
Consider:
- Documenting the security implications of accessing the raw implementation
- Adding access controls or limiting the exposed functionality
- Evaluating if this exposure is necessary for the Touch ID/Windows Hello integration
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/test/java/org/cryptomator/common/keychain/KeychainManagerTest.java (1)
Add test coverage for biometric authentication features
The codebase lacks test coverage for biometric authentication features. Current tests only cover basic keychain operations. Required test coverage:
- Enabling/disabling biometric authentication
- Authentication flow with Touch ID/Windows Hello
- Error handling for biometric authentication failures
- Integration with platform-specific keychain implementations
🔗 Analysis chain
Line range hint
37-55: Add test coverage for biometric authentication.Based on the PR objectives to add Touch ID and Windows Hello support, we need test coverage for:
- Enabling/disabling biometric authentication
- Authentication flow with Touch ID/Windows Hello
- Error handling for biometric authentication failures
Let's verify if there are any existing biometric authentication tests:
Would you like me to help create test cases for the biometric authentication features?
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for biometric authentication related tests echo "Searching for biometric authentication test files..." fd -e java -e kt test | xargs rg -l "Touch.*ID|Windows.*Hello|[Bb]iometric" echo "Searching for biometric authentication test methods..." ast-grep --pattern 'class $_ { $$$ @Test $$$ test$_(Touch|Hello|Biometric)$_($$$) { $$$ } $$$ }'Length of output: 484
Script:
#!/bin/bash # Check content of EnvironmentTest.java echo "=== Content of EnvironmentTest.java ===" cat src/test/java/org/cryptomator/common/EnvironmentTest.java echo -e "\n=== Searching for biometric implementation files ===" rg -l "biometric|touchid|hello" --type java --type kotlin echo -e "\n=== Searching for keychain/auth related test files ===" fd -e java -e kt test | xargs rg -l "keychain|auth|credential"Length of output: 4792
Script:
#!/bin/bash echo "=== Content of HandleLaunchArgsMessageTest.java ===" cat src/test/java/org/cryptomator/ipc/HandleLaunchArgsMessageTest.java echo -e "\n=== Full content of KeychainManagerTest.java ===" cat src/test/java/org/cryptomator/common/keychain/KeychainManagerTest.javaLength of output: 3920
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/JavaFXUtil.java (1)
1-20: Add documentation and improve error handling.The utility class needs the following improvements:
- Add class-level JavaDoc explaining its purpose and usage
- Extract timeout value as a constant
- Consider adding debug logging for initialization failures
Apply this diff:
package org.cryptomator; import javafx.application.Platform; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +/** + * Utility class for JavaFX platform initialization. + * Provides thread-safe initialization of the JavaFX runtime with timeout handling. + */ public class JavaFXUtil { + private static final Logger LOG = LoggerFactory.getLogger(JavaFXUtil.class); + private static final int PLATFORM_STARTUP_TIMEOUT_SECONDS = 5; public static boolean startPlatform() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); try { Platform.startup(latch::countDown); } catch (IllegalStateException e) { //already initialized + LOG.debug("JavaFX platform already initialized"); latch.countDown(); } - return latch.await(5, TimeUnit.SECONDS); + boolean started = latch.await(PLATFORM_STARTUP_TIMEOUT_SECONDS, TimeUnit.SECONDS); + if (!started) { + LOG.error("JavaFX platform initialization timed out after {} seconds", PLATFORM_STARTUP_TIMEOUT_SECONDS); + } + return started; } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/org/cryptomator/JavaFXUtil.java(1 hunks)src/test/java/org/cryptomator/common/keychain/KeychainManagerTest.java(3 hunks)src/test/java/org/cryptomator/ui/controls/SecurePasswordFieldTest.java(2 hunks)
🔇 Additional comments (2)
src/test/java/org/cryptomator/ui/controls/SecurePasswordFieldTest.java (1)
3-3: LGTM!Good refactoring to use the centralized JavaFX initialization utility.
Also applies to: 22-23
src/test/java/org/cryptomator/common/keychain/KeychainManagerTest.java (1)
23-27: LGTM!Good refactoring to use the centralized JavaFX initialization utility.
|
Has this been merged or what is the reason for this PR being closed? |
|
We'll integrate TouchID and Windows Support in seperate PRs. Additionally, it contained too many unrelated changes. |




Depends on cryptomator/integrations-mac#36.Obsolete.Depends on cryptomator/integrations-api#41.
Depends on cryptomator/integrations-mac#58.
Depends on cryptomator/integrations-win#83.
This PR war started as a base to make Touch ID on Mac available. Meanwhile, Windows Hello support was realized by another PR and this PR is the base for both, Touch ID on Mac and Windows Hello.