Update av alert

This commit is contained in:
crschnick
2023-12-27 04:23:11 +00:00
parent 404cd744b2
commit 6e3b044fdc
7 changed files with 126 additions and 142 deletions
@@ -1,61 +0,0 @@
package io.xpipe.app.core.check;
import io.xpipe.app.comp.base.MarkdownComp;
import io.xpipe.app.core.*;
import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.util.PlatformState;
import io.xpipe.app.util.WindowsRegistry;
import io.xpipe.core.process.OsType;
import javafx.geometry.Insets;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import java.nio.file.Files;
import java.util.Optional;
public class AppAvBlockCheck {
private static Optional<String> detect() {
var bitdefender = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE,"SOFTWARE\\Bitdefender", "InstallDir");
if (bitdefender.isPresent()) {
return Optional.of("Bitdefender");
}
return Optional.empty();
}
public static void check() throws Throwable {
// Only show this on first launch on windows
if (OsType.getLocal() != OsType.WINDOWS || !AppState.get().isInitialLaunch()) {
return;
}
var found = detect();
if (found.isEmpty()) {
return;
}
PlatformState.initPlatformOrThrow();
AppStyle.init();
AppImages.init();
var a = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("antivirusNoticeTitle"));
alert.setAlertType(Alert.AlertType.NONE);
AppResources.with(
AppResources.XPIPE_MODULE,
"misc/antivirus.md",
file -> {
var markdown = new MarkdownComp(Files.readString(file), s -> s.formatted(found.get(), found.get(), AppProperties.get().getVersion(), AppProperties.get().getVersion(), found.get())).prefWidth(550).prefHeight(600).createRegion();
alert.getDialogPane().setContent(markdown);
alert.getDialogPane().setPadding(new Insets(15));
});
alert.getButtonTypes().add(new ButtonType(AppI18n.get("gotIt"), ButtonBar.ButtonData.OK_DONE));
});
a.filter(b -> b.getButtonData().isDefaultButton())
.ifPresentOrElse(buttonType -> {}, () -> OperationMode.halt(1));
}
}
@@ -0,0 +1,116 @@
package io.xpipe.app.core.check;
import io.xpipe.app.comp.base.MarkdownComp;
import io.xpipe.app.core.*;
import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.util.PlatformState;
import io.xpipe.app.util.WindowsRegistry;
import io.xpipe.core.process.OsType;
import javafx.geometry.Insets;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import lombok.Getter;
import java.nio.file.Files;
import java.util.Optional;
public class AppAvCheck {
@Getter
public static enum AvType {
BITDEFENDER("Bitdefender") {
@Override
public String getDescription() {
return "Bitdefender sometimes isolates XPipe and some shell programs, effectively making it unusable.";
}
@Override
public boolean isActive() {
var bitdefender = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE,"SOFTWARE\\Bitdefender", "InstallDir");
return bitdefender.isPresent();
}
},
MALWAREBYTES("Malwarebytes") {
@Override
public String getDescription() {
return "The free Malwarebytes version performs less invasive scans, so it shouldn't be a problem. If you are running the paid Malwarebytes Pro version, you will have access to the `Exploit Protection` under the `Real-time Protection` mode. When this setting is active, any shell access is slowed down, resulting in XPipe becoming very slow.";
}
@Override
public boolean isActive() {
var reg = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE,"SOFTWARE\\Malwarebytes", "id");
return reg.isPresent();
}
},
MCAFEE("McAfee") {
@Override
public String getDescription() {
return "McAfee slows down XPipe considerably. It also sometimes preemptively disables some Win32 commands that XPipe depends on, leading to errors.";
}
@Override
public boolean isActive() {
var mcafee = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE,"SOFTWARE\\McAfee", "mi");
return mcafee.isPresent();
}
};
private final String name;
AvType(String name) {
this.name = name;
}
public abstract String getDescription();
public abstract boolean isActive();
}
private static Optional<AvType> detect() {
for (AvType value : AvType.values()) {
if (value.isActive()) {
return Optional.of(value);
}
}
return Optional.empty();
}
public static void check() throws Throwable {
// Only show this on first launch on windows
if (OsType.getLocal() != OsType.WINDOWS || !AppState.get().isInitialLaunch()) {
return;
}
var found = detect();
if (found.isEmpty()) {
return;
}
PlatformState.initPlatformOrThrow();
AppStyle.init();
AppImages.init();
var a = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("antivirusNoticeTitle"));
alert.setAlertType(Alert.AlertType.NONE);
AppResources.with(
AppResources.XPIPE_MODULE,
"misc/antivirus.md",
file -> {
var markdown = new MarkdownComp(Files.readString(file), s -> {
var t = found.get();
return s.formatted(t.getName(), t.getName(), t.getDescription(), AppProperties.get().getVersion(), AppProperties.get().getVersion(), t.getName());
}).prefWidth(550).prefHeight(600).createRegion();
alert.getDialogPane().setContent(markdown);
alert.getDialogPane().setPadding(new Insets(15));
});
alert.getButtonTypes().add(new ButtonType(AppI18n.get("gotIt"), ButtonBar.ButtonData.OK_DONE));
});
a.filter(b -> b.getButtonData().isDefaultButton())
.ifPresentOrElse(buttonType -> {}, () -> OperationMode.halt(1));
}
}
@@ -1,58 +0,0 @@
package io.xpipe.app.core.check;
import io.xpipe.app.comp.base.MarkdownComp;
import io.xpipe.app.core.*;
import io.xpipe.app.util.PlatformState;
import io.xpipe.app.util.WindowsRegistry;
import io.xpipe.core.process.OsType;
import javafx.geometry.Insets;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import java.nio.file.Files;
public class AppMalwarebytesCheck {
private static boolean detect() {
var reg = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE,"SOFTWARE\\Malwarebytes", "id");
if (reg.isPresent()) {
return true;
}
return false;
}
public static void check() throws Throwable {
// Only show this on first launch on windows
if (OsType.getLocal() != OsType.WINDOWS || AppCache.get("malwarebytesSeen", Boolean.class,() -> false)) {
return;
}
var found = detect();
if (!found) {
return;
}
PlatformState.initPlatformOrThrow();
AppStyle.init();
AppImages.init();
var a = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("malwarebytesNoticeTitle"));
alert.setAlertType(Alert.AlertType.NONE);
AppResources.with(
AppResources.XPIPE_MODULE,
"misc/malwarebytes.md",
file -> {
var markdown = new MarkdownComp(Files.readString(file), s -> s).prefWidth(550).prefHeight(500).createRegion();
alert.getDialogPane().setContent(markdown);
alert.getDialogPane().setPadding(new Insets(15));
});
alert.getButtonTypes().add(new ButtonType(AppI18n.get("gotIt"), ButtonBar.ButtonData.OK_DONE));
});
a.filter(b -> b.getButtonData().isDefaultButton())
.ifPresentOrElse(buttonType -> {}, () -> AppCache.update("malwarebytesSeen", true));
}
}
@@ -3,8 +3,7 @@ package io.xpipe.app.core.mode;
import io.xpipe.app.browser.BrowserModel;
import io.xpipe.app.comp.store.StoreViewState;
import io.xpipe.app.core.*;
import io.xpipe.app.core.check.AppAvBlockCheck;
import io.xpipe.app.core.check.AppMalwarebytesCheck;
import io.xpipe.app.core.check.AppAvCheck;
import io.xpipe.app.ext.ActionProvider;
import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.prefs.AppPrefs;
@@ -49,8 +48,7 @@ public class BaseMode extends OperationMode {
// Also loaded before antivirus alert to localize that
AppI18n.init();
LicenseProvider.get().init();
AppAvBlockCheck.check();
AppMalwarebytesCheck.check();
AppAvCheck.check();
LocalShell.init();
XPipeDistributionType.init();
AppPrefs.init();
@@ -99,7 +99,7 @@ public class LauncherCommand implements Callable<Integer> {
} catch (Exception ex) {
var cli = XPipeInstallation.getLocalDefaultCliExecutable();
ErrorEvent.fromThrowable(ex).term().description("Unable to connect to existing running daemon instance as it did not respond." +
" Either try to kill the process xpiped manually or use the command " + cli + " daemon stop --force.").handle();
" Either try to kill the process xpiped manually or use the command \"" + cli + "\" daemon stop --force.").handle();
}
}
@@ -1,16 +1,18 @@
### Information about antivirus programs
XPipe detected that you are running %s. As a result, you might run into a few problems due to %s detecting suspicious activity when XPipe is interacting with your shell programs. This can range from just notifications to full isolation of XPipe and your shell programs, effectively making the application unusable and causing errors.
XPipe detected that you are running %s. As a result, you might run into a few problems due to %s detecting suspicious activity when XPipe is interacting with your shell programs. This can range from severy slowdowns, notifications, up to full isolation of XPipe and your shell programs, effectively making the application unusable and causing errors.
%s
### Threat analysis
For this reason, all artifacts of every release are automatically uploaded and analyzed on [VirusTotal](https://virustotal.com), so uploading the release you downloaded to VirusTotal should instantly show complete analysis results. From there you should be able to get a more accurate overview over the threat level of XPipe to you.
You can find the analysis results listed at the bottom of every release on GitHub, i.e. at [https://github.com/xpipe-io/xpipe/releases/tag/%s](https://github.com/xpipe-io/xpipe/releases/tag/%s)
All artifacts of every release are automatically uploaded and analyzed on [VirusTotal](https://virustotal.com), so uploading the release you downloaded to VirusTotal should instantly show complete analysis results. From there you should be able to get a more accurate overview over the threat level of XPipe to you.
You can also find the analysis results listed at the bottom of every release on GitHub, i.e. at [https://github.com/xpipe-io/xpipe/releases/tag/%s](https://github.com/xpipe-io/xpipe/releases/tag/%s)
You can also find detailed information about the security model of XPipe at [https://docs.xpipe.io/security](https://docs.xpipe.io/security).
Furthermore, you can find detailed information about the security model of XPipe at [https://docs.xpipe.io/security](https://docs.xpipe.io/security). From there you should be able to get a more accurate overview over the threat level of XPipe to you if you are feeling uneasy about turning any protection off.
### What you can do
If such a false-positive also happens on your end, you might have to explicitly whitelist XPipe in order for it to work correctly. Accessing shells is necessary for XPipe, there is no fallback alternative built in that does not launch shells.
If such a protection kicks in or false-positive happens on your end, you might have to explicitly whitelist XPipe or disable certain protections in order for it to work correctly. Accessing shells is necessary for XPipe, there is no fallback alternative built in that does not launch shells.
If you choose to continue from here, XPipe will start calling shell programs to properly initialize, which might provoke %s.
@@ -1,13 +0,0 @@
### Information about Malwarebytes
XPipe detected that you are running Malwarebytes. Certain protection settings in Malwarebytes Pro can slow down XPipe massively to the point where it's basically unusable.
The free Malwarebytes version is not affected by this interaction, so it shouldn't be a problem.
If you are running the paid Malwarebytes Pro version, you will have access to the `Exploit Protection` under the `Real-time Protection` mode. When this setting is active, any shell access is slowed down, resulting in XPipe becoming very slow.
### What you can do
In case you are facing performance problems with XPipe and Malwarebytes, it is recommended to try to disable the `Exploit Protection` setting for XPipe and see whether it makes a difference.
### Security information
You can find detailed information about the security model of XPipe at [https://docs.xpipe.io/security](https://docs.xpipe.io/security). From there you should be able to get a more accurate overview over the threat level of XPipe to you if you are feeling uneasy about turning this protection off.