mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Fixes [stage]
This commit is contained in:
parent
097a463e0e
commit
73131a3f0c
10 changed files with 49 additions and 12 deletions
|
@ -18,12 +18,16 @@ public class SecretFieldComp extends Comp<CompStructure<TextField>> {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SecretValue encrypt(char[] c) {
|
||||||
|
return SecretHelper.encrypt(c);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompStructure<TextField> createBase() {
|
public CompStructure<TextField> createBase() {
|
||||||
var text = new PasswordField();
|
var text = new PasswordField();
|
||||||
text.setText(value.getValue() != null ? value.getValue().getSecretValue() : null);
|
text.setText(value.getValue() != null ? value.getValue().getSecretValue() : null);
|
||||||
text.textProperty().addListener((c, o, n) -> {
|
text.textProperty().addListener((c, o, n) -> {
|
||||||
value.setValue(n != null && n.length() > 0 ? SecretHelper.encrypt(n) : null);
|
value.setValue(n != null && n.length() > 0 ? encrypt(n.toCharArray()) : null);
|
||||||
});
|
});
|
||||||
value.addListener((c, o, n) -> {
|
value.addListener((c, o, n) -> {
|
||||||
PlatformThread.runLaterIfNeeded(() -> {
|
PlatformThread.runLaterIfNeeded(() -> {
|
||||||
|
|
|
@ -15,7 +15,13 @@ public class ExceptionConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
return switch (ex) {
|
return switch (ex) {
|
||||||
case ProcessOutputException e -> e.getOutput();
|
case ProcessOutputException e -> {
|
||||||
|
if (e.getOutput().isBlank()) {
|
||||||
|
yield e.getMessage();
|
||||||
|
} else {
|
||||||
|
yield e.getOutput();
|
||||||
|
}
|
||||||
|
}
|
||||||
case StackOverflowError e -> AppI18n.get("app.stackOverflow");
|
case StackOverflowError e -> AppI18n.get("app.stackOverflow");
|
||||||
case OutOfMemoryError e -> AppI18n.get("app.outOfMemory");
|
case OutOfMemoryError e -> AppI18n.get("app.outOfMemory");
|
||||||
case FileNotFoundException e -> AppI18n.get("app.fileNotFound", msg);
|
case FileNotFoundException e -> AppI18n.get("app.fileNotFound", msg);
|
||||||
|
|
|
@ -270,11 +270,15 @@ public class AppPrefs {
|
||||||
lockCrypt.setValue(new LockedSecretValue("xpipe".toCharArray()).getEncryptedValue());
|
lockCrypt.setValue(new LockedSecretValue("xpipe".toCharArray()).getEncryptedValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkLock(SecretValue lockPw) {
|
public boolean unlock(SecretValue lockPw) {
|
||||||
lockPassword.setValue(lockPw);
|
lockPassword.setValue(lockPw);
|
||||||
var check = new LockedSecretValue("xpipe".toCharArray()).getEncryptedValue();
|
var check = new LockedSecretValue("xpipe".toCharArray()).getEncryptedValue();
|
||||||
lockPassword.setValue(null);
|
if (!check.equals(lockCrypt.get())) {
|
||||||
return check.equals(lockCrypt.get());
|
lockPassword.setValue(null);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringProperty getLockCrypt() {
|
public StringProperty getLockCrypt() {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package io.xpipe.app.util;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import io.xpipe.core.util.AesSecretValue;
|
import io.xpipe.core.util.AesSecretValue;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import lombok.extern.jackson.Jacksonized;
|
import lombok.extern.jackson.Jacksonized;
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ import java.util.Random;
|
||||||
@JsonTypeName("default")
|
@JsonTypeName("default")
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@Jacksonized
|
@Jacksonized
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class DefaultSecretValue extends AesSecretValue {
|
public class DefaultSecretValue extends AesSecretValue {
|
||||||
|
|
||||||
public DefaultSecretValue(char[] secret) {
|
public DefaultSecretValue(char[] secret) {
|
||||||
|
|
|
@ -22,18 +22,28 @@ public class LockChangeAlert {
|
||||||
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
||||||
|
|
||||||
var label1 = new LabelComp(AppI18n.observable("password")).createRegion();
|
var label1 = new LabelComp(AppI18n.observable("password")).createRegion();
|
||||||
var p1 = new SecretFieldComp(prop1).createRegion();
|
var p1 = new SecretFieldComp(prop1) {
|
||||||
|
@Override
|
||||||
|
protected SecretValue encrypt(char[] c) {
|
||||||
|
return SecretHelper.encryptInPlace(c);
|
||||||
|
}
|
||||||
|
}.createRegion();
|
||||||
p1.setStyle("-fx-border-width: 1px");
|
p1.setStyle("-fx-border-width: 1px");
|
||||||
|
|
||||||
var label2 = new LabelComp(AppI18n.observable("repeatPassword")).createRegion();
|
var label2 = new LabelComp(AppI18n.observable("repeatPassword")).createRegion();
|
||||||
var p2 = new SecretFieldComp(prop2).createRegion();
|
var p2 = new SecretFieldComp(prop2) {
|
||||||
|
@Override
|
||||||
|
protected SecretValue encrypt(char[] c) {
|
||||||
|
return SecretHelper.encryptInPlace(c);
|
||||||
|
}
|
||||||
|
}.createRegion();
|
||||||
p1.setStyle("-fx-border-width: 1px");
|
p1.setStyle("-fx-border-width: 1px");
|
||||||
|
|
||||||
var content = new VBox(label1, p1, new Spacer(15), label2, p2);
|
var content = new VBox(label1, p1, new Spacer(15), label2, p2);
|
||||||
content.setSpacing(5);
|
content.setSpacing(5);
|
||||||
alert.getDialogPane().setContent(content);
|
alert.getDialogPane().setContent(content);
|
||||||
})
|
})
|
||||||
.filter(b -> b.getButtonData().isDefaultButton() && (prop1.getValue() != null && prop2.getValue() != null && prop1.getValue().equals(prop2.getValue())) || (prop1.getValue() == null && prop2.getValue() == null))
|
.filter(b -> b.getButtonData().isDefaultButton() && ((prop1.getValue() != null && prop2.getValue() != null && prop1.getValue().equals(prop2.getValue())) || (prop1.getValue() == null && prop2.getValue() == null)))
|
||||||
.ifPresent(t -> {
|
.ifPresent(t -> {
|
||||||
AppPrefs.get().changeLock(prop1.getValue());
|
AppPrefs.get().changeLock(prop1.getValue());
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.xpipe.app.util;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import io.xpipe.app.prefs.AppPrefs;
|
import io.xpipe.app.prefs.AppPrefs;
|
||||||
import io.xpipe.core.util.AesSecretValue;
|
import io.xpipe.core.util.AesSecretValue;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import lombok.extern.jackson.Jacksonized;
|
import lombok.extern.jackson.Jacksonized;
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ import java.util.Random;
|
||||||
@JsonTypeName("locked")
|
@JsonTypeName("locked")
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@Jacksonized
|
@Jacksonized
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class LockedSecretValue extends AesSecretValue {
|
public class LockedSecretValue extends AesSecretValue {
|
||||||
|
|
||||||
public LockedSecretValue(char[] secret) {
|
public LockedSecretValue(char[] secret) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class UnlockAlert {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AppPrefs.get().checkLock(pw.get())) {
|
if (AppPrefs.get().unlock(pw.get())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.xpipe.core.util;
|
package io.xpipe.core.util;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import lombok.extern.jackson.Jacksonized;
|
import lombok.extern.jackson.Jacksonized;
|
||||||
|
@ -15,6 +16,7 @@ import java.security.spec.InvalidKeySpecException;
|
||||||
|
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@Jacksonized
|
@Jacksonized
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class AesSecretValue extends EncryptedSecretValue {
|
public class AesSecretValue extends EncryptedSecretValue {
|
||||||
|
|
||||||
private static final String ENCRYPT_ALGO = "AES/GCM/NoPadding";
|
private static final String ENCRYPT_ALGO = "AES/GCM/NoPadding";
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.xpipe.core.util;
|
package io.xpipe.core.util;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import lombok.extern.jackson.Jacksonized;
|
import lombok.extern.jackson.Jacksonized;
|
||||||
|
@ -11,6 +12,7 @@ import java.util.Base64;
|
||||||
|
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@Jacksonized
|
@Jacksonized
|
||||||
|
@EqualsAndHashCode
|
||||||
public class EncryptedSecretValue implements SecretValue {
|
public class EncryptedSecretValue implements SecretValue {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -38,7 +40,7 @@ public class EncryptedSecretValue implements SecretValue {
|
||||||
charBuffer.get(chars);
|
charBuffer.get(chars);
|
||||||
return chars;
|
return chars;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return new char[0];
|
throw new IllegalStateException("Unable to decrypt secret");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
dist/changelogs/0.5.36.md
vendored
9
dist/changelogs/0.5.36.md
vendored
|
@ -1,7 +1,12 @@
|
||||||
## Changes in 0.5.36
|
## Changes in 0.5.36
|
||||||
- Add support for PowerShell Remote connections
|
- Add support to lock your workspace with a custom password similar to password managers.
|
||||||
|
This will encrypt all stored sensitive information using the password as the key.
|
||||||
|
The general password encryption has also been reworked, which results in all existing passwords becoming invalid.
|
||||||
|
So make sure to reenter your passwords for any connection.
|
||||||
|
- Improve file browser performance
|
||||||
|
- Add experimental support for PowerShell Remote connections
|
||||||
- Add support for PowerShell core shell environments
|
- Add support for PowerShell core shell environments
|
||||||
- Implement initial support for package manager builds
|
- Implement initial support for future package manager builds
|
||||||
- Rework updating system to accommodate package managers
|
- Rework updating system to accommodate package managers
|
||||||
- Improve error handling
|
- Improve error handling
|
||||||
- Fix many bugs
|
- Fix many bugs
|
||||||
|
|
Loading…
Reference in a new issue