From 4476558e9cde1c43ff6962e52a1b89cb4dfab134 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 16 Aug 2016 12:33:15 +0200 Subject: [PATCH 01/45] fixes #321 --- main/filesystem-crypto/pom.xml | 2 +- .../cryptomator/crypto/engine/impl/FilenameCryptorImpl.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/main/filesystem-crypto/pom.xml b/main/filesystem-crypto/pom.xml index 35f308aeb..bbc582be6 100644 --- a/main/filesystem-crypto/pom.xml +++ b/main/filesystem-crypto/pom.xml @@ -19,7 +19,7 @@ 1.51 - 1.0.7 + 1.0.8 diff --git a/main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/FilenameCryptorImpl.java b/main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/FilenameCryptorImpl.java index 75408f609..e19cb0e25 100644 --- a/main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/FilenameCryptorImpl.java +++ b/main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/FilenameCryptorImpl.java @@ -15,6 +15,7 @@ import java.security.NoSuchAlgorithmException; import java.util.regex.Pattern; import javax.crypto.AEADBadTagException; +import javax.crypto.IllegalBlockSizeException; import javax.crypto.SecretKey; import org.apache.commons.codec.binary.Base32; @@ -70,8 +71,8 @@ class FilenameCryptorImpl implements FilenameCryptor { try { final byte[] cleartextBytes = AES_SIV.get().decrypt(encryptionKey, macKey, encryptedBytes, associatedData); return new String(cleartextBytes, UTF_8); - } catch (AEADBadTagException e) { - throw new AuthenticationFailedException("Authentication failed.", e); + } catch (AEADBadTagException | IllegalBlockSizeException e) { + throw new AuthenticationFailedException("Invalid ciphertext.", e); } } From 24bfbb59a404c0b0546a29a56aa243b635e2f064 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 16 Aug 2016 19:07:05 +0200 Subject: [PATCH 02/45] fixes #310 --- .../ui/logging/ConfigurableFileAppender.java | 83 ++++++++++--------- main/ui/src/main/resources/log4j2.xml | 20 +++-- 2 files changed, 59 insertions(+), 44 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java b/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java index 7354fb544..375c51352 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java +++ b/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java @@ -19,6 +19,7 @@ import java.util.regex.Pattern; import org.apache.commons.lang3.SystemUtils; import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.Layout; +import org.apache.logging.log4j.core.appender.AbstractAppender; import org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender; import org.apache.logging.log4j.core.appender.FileManager; import org.apache.logging.log4j.core.config.plugins.Plugin; @@ -26,10 +27,11 @@ import org.apache.logging.log4j.core.config.plugins.PluginAttribute; import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.core.layout.PatternLayout; +import org.apache.logging.log4j.core.util.Booleans; import org.apache.logging.log4j.util.Strings; /** - * A preconfigured FileAppender only relying on a configurable system property, e.g. -DlogPath=/var/log/cryptomator.log.
+ * A preconfigured FileAppender only relying on a configurable system property, e.g. -Dcryptomator.logPath=/var/log/cryptomator.log.
* Other than the normal {@link org.apache.logging.log4j.core.appender.FileAppender} paths can be resolved relative to the users home directory. */ @Plugin(name = "ConfigurableFile", category = "Core", elementType = "appender", printObject = true) @@ -37,7 +39,6 @@ public class ConfigurableFileAppender extends AbstractOutputStreamAppender layout, Filter filter, FileManager manager) { @@ -46,9 +47,8 @@ public class ConfigurableFileAppender extends AbstractOutputStreamAppender layout) { - if (name == null) { LOGGER.error("No name provided for HomeDirectoryAwareFileAppender"); return null; @@ -59,41 +59,16 @@ public class ConfigurableFileAppender extends AbstractOutputStreamAppender - + @@ -18,21 +18,27 @@ - - + + + + - + - + + + + + - + - + From 461b11700f38d71433e34dc5aee8ccd5cec57864 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 16 Aug 2016 19:15:23 +0200 Subject: [PATCH 03/45] added new upgrade log path setting to build script [ci skip] --- main/ant-kit/src/main/resources/build.xml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/main/ant-kit/src/main/resources/build.xml b/main/ant-kit/src/main/resources/build.xml index 06dcfc257..018df82f4 100644 --- a/main/ant-kit/src/main/resources/build.xml +++ b/main/ant-kit/src/main/resources/build.xml @@ -21,21 +21,6 @@ - - - - - - - - - - - - - - - @@ -45,7 +30,8 @@ - + + @@ -66,7 +52,8 @@ - + + From fe0a34907fa16039b4b6f269eb3bd4e45adbdde5 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 17 Aug 2016 15:59:36 +0200 Subject: [PATCH 04/45] Simplified settings/log file path handling. Removed support for %appdata%. Use ~/AppData/Roaming instead! --- main/ant-kit/src/main/resources/build.xml | 2 ++ .../ui/logging/ConfigurableFileAppender.java | 4 --- .../cryptomator/ui/settings/Localization.java | 2 +- .../ui/settings/SettingsProvider.java | 28 +++++++------------ 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/main/ant-kit/src/main/resources/build.xml b/main/ant-kit/src/main/resources/build.xml index 018df82f4..89dd5c4bb 100644 --- a/main/ant-kit/src/main/resources/build.xml +++ b/main/ant-kit/src/main/resources/build.xml @@ -31,6 +31,7 @@ + @@ -53,6 +54,7 @@ + diff --git a/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java b/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java index 375c51352..9074f9a87 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java +++ b/main/ui/src/main/java/org/cryptomator/ui/logging/ConfigurableFileAppender.java @@ -97,10 +97,6 @@ public class ConfigurableFileAppender extends AbstractOutputStreamAppender { private static final Logger LOG = LoggerFactory.getLogger(SettingsProvider.class); - private static final Path SETTINGS_DIR; - private static final String SETTINGS_FILE = "settings.json"; + private static final Path DEFAULT_SETTINGS_PATH; private static final long SAVE_DELAY_MS = 1000; static { - final String appdata = System.getenv("APPDATA"); final FileSystem fs = FileSystems.getDefault(); - - if (SystemUtils.IS_OS_WINDOWS && appdata != null) { - SETTINGS_DIR = fs.getPath(appdata, "Cryptomator"); - } else if (SystemUtils.IS_OS_WINDOWS && appdata == null) { - SETTINGS_DIR = fs.getPath(SystemUtils.USER_HOME, ".Cryptomator"); + if (SystemUtils.IS_OS_WINDOWS) { + DEFAULT_SETTINGS_PATH = fs.getPath(SystemUtils.USER_HOME, "AppData/Roaming/Cryptomator/settings.json"); } else if (SystemUtils.IS_OS_MAC_OSX) { - SETTINGS_DIR = fs.getPath(SystemUtils.USER_HOME, "Library/Application Support/Cryptomator"); + DEFAULT_SETTINGS_PATH = fs.getPath(SystemUtils.USER_HOME, "Library/Application Support/Cryptomator/settings.json"); } else { - // (os.contains("solaris") || os.contains("sunos") || os.contains("linux") || os.contains("unix")) - SETTINGS_DIR = fs.getPath(SystemUtils.USER_HOME, ".Cryptomator"); + DEFAULT_SETTINGS_PATH = fs.getPath(SystemUtils.USER_HOME, ".Cryptomator/settings.json"); } } @@ -68,12 +64,8 @@ public class SettingsProvider implements Provider { } private Path getSettingsPath() throws IOException { - String settingsPathProperty = System.getProperty("cryptomator.settingsPath"); - if (settingsPathProperty == null) { - return SETTINGS_DIR.resolve(SETTINGS_FILE); - } else { - return FileSystems.getDefault().getPath(settingsPathProperty); - } + final String settingsPathProperty = System.getProperty("cryptomator.settingsPath"); + return Optional.ofNullable(settingsPathProperty).filter(StringUtils::isNotBlank).map(FileSystems.getDefault()::getPath).orElse(DEFAULT_SETTINGS_PATH); } @Override @@ -96,7 +88,7 @@ public class SettingsProvider implements Provider { } ScheduledFuture saveCmd = saveScheduler.schedule(() -> { this.save(settings); - } , SAVE_DELAY_MS, TimeUnit.MILLISECONDS); + }, SAVE_DELAY_MS, TimeUnit.MILLISECONDS); ScheduledFuture previousSaveCmd = scheduledSaveCmd.getAndSet(saveCmd); if (previousSaveCmd != null) { previousSaveCmd.cancel(false); From 1f73a08e09c3bd4e5d69e010b7da94d935c029f2 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Wed, 17 Aug 2016 18:11:27 +0200 Subject: [PATCH 05/45] added confirmation checkbox to upgrade screen [ci skip] --- .../ui/controllers/UpgradeController.java | 9 ++++++++- main/ui/src/main/resources/css/linux_theme.css | 6 +++--- main/ui/src/main/resources/css/mac_theme.css | 2 +- main/ui/src/main/resources/css/win_theme.css | 2 +- main/ui/src/main/resources/fxml/upgrade.fxml | 14 +++++++++----- main/ui/src/main/resources/localization/en.txt | 1 + 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/controllers/UpgradeController.java b/main/ui/src/main/java/org/cryptomator/ui/controllers/UpgradeController.java index 729f3fdf9..a34e2aeb6 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controllers/UpgradeController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controllers/UpgradeController.java @@ -15,11 +15,13 @@ import org.cryptomator.ui.settings.Localization; import org.cryptomator.ui.util.AsyncTaskService; import org.fxmisc.easybind.EasyBind; +import javafx.beans.binding.BooleanExpression; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.control.ProgressIndicator; @@ -44,6 +46,9 @@ public class UpgradeController extends LocalizedFXMLViewController { @FXML private SecPasswordField passwordField; + @FXML + private CheckBox confirmationCheckbox; + @FXML private Button upgradeButton; @@ -59,7 +64,9 @@ public class UpgradeController extends LocalizedFXMLViewController { return instruction.map(this::upgradeNotification).orElse(""); }).orElse("")); - upgradeButton.disableProperty().bind(passwordField.textProperty().isEmpty().or(passwordField.disabledProperty())); + BooleanExpression passwordProvided = passwordField.textProperty().isNotEmpty().and(passwordField.disabledProperty().not()); + BooleanExpression syncFinished = confirmationCheckbox.selectedProperty(); + upgradeButton.disableProperty().bind(passwordProvided.not().or(syncFinished.not())); EasyBind.subscribe(vault, this::vaultDidChange); } diff --git a/main/ui/src/main/resources/css/linux_theme.css b/main/ui/src/main/resources/css/linux_theme.css index 38f453feb..f3b2f3576 100644 --- a/main/ui/src/main/resources/css/linux_theme.css +++ b/main/ui/src/main/resources/css/linux_theme.css @@ -305,17 +305,17 @@ ****************************************************************************/ .check-box { - -fx-label-padding: 0 0 0 3; + -fx-label-padding: 0 0 0 6px; -fx-text-fill: COLOR_TEXT; } .check-box > .box { - -fx-padding: 3; + -fx-padding: 3px; -fx-background-color: COLOR_BORDER_DARK, #FFF; -fx-background-insets: 0, 1; } .check-box > .box > .mark { -fx-background-color: transparent; - -fx-padding: 4; + -fx-padding: 4px; -fx-shape: "M-1,4, L-1,5.5 L3.5,8.5 L9,0 L9,-1 L7,-1 L3,6 L1,4 Z"; } .check-box:selected > .box { diff --git a/main/ui/src/main/resources/css/mac_theme.css b/main/ui/src/main/resources/css/mac_theme.css index bb5fa2053..ffd4b637e 100644 --- a/main/ui/src/main/resources/css/mac_theme.css +++ b/main/ui/src/main/resources/css/mac_theme.css @@ -386,7 +386,7 @@ ******************************************************************************/ .check-box { - -fx-label-padding: 0 0 0 3px; + -fx-label-padding: 0 0 0 6px; -fx-text-fill: COLOR_TEXT; } .check-box > .box { diff --git a/main/ui/src/main/resources/css/win_theme.css b/main/ui/src/main/resources/css/win_theme.css index 72fa8cb53..0c0c29c84 100644 --- a/main/ui/src/main/resources/css/win_theme.css +++ b/main/ui/src/main/resources/css/win_theme.css @@ -354,7 +354,7 @@ ******************************************************************************/ .check-box { - -fx-label-padding: 0 0 0 3px; + -fx-label-padding: 0 0 0 6px; -fx-text-fill: COLOR_TEXT; } .check-box > .box { diff --git a/main/ui/src/main/resources/fxml/upgrade.fxml b/main/ui/src/main/resources/fxml/upgrade.fxml index 5d54014a3..24fc99d0a 100644 --- a/main/ui/src/main/resources/fxml/upgrade.fxml +++ b/main/ui/src/main/resources/fxml/upgrade.fxml @@ -17,6 +17,8 @@ + + @@ -34,15 +36,17 @@ -