summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 05:07:27 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 05:07:27 -0600
commitb3981d3c903aed60a463faf9a48135b5a89d79c2 (patch)
treed31f9de9d69f3d51f7b34c20a5a83cb9eb813381
parentfd6ace34f09a15703beaa08c7f8171ccc8a0a1b8 (diff)
ToolsInstaller: restrict to only main app usage
We don't want lots of different packages fighting over who gets to install the tools.
-rw-r--r--app/src/main/java/com/wireguard/android/util/ToolsInstaller.java2
1 files changed, 2 insertions, 0 deletions
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();
}