From fd573f6c1c37bcfcd09237dfcd55e08b1e0eaff9 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 9 Mar 2020 05:07:27 -0600 Subject: [PATCH] ToolsInstaller: restrict to only main app usage We don't want lots of different packages fighting over who gets to install the tools. Signed-off-by: Jason A. Donenfeld --- .../main/java/com/wireguard/android/util/ToolsInstaller.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java b/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java index 89607768..ac18cabf 100644 --- a/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java +++ b/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java @@ -105,6 +105,8 @@ public final class ToolsInstaller { } public int install() throws RootShellException, IOException { + if (!context.getPackageName().startsWith("com.wireguard.")) + throw new SecurityException("The tools may only be installed system-wide from the main WireGuard app."); return willInstallAsMagiskModule() ? installMagisk() : installSystem(); }