From 3b1673584b6e7ebba3bf6634b5881002b928035a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 15 Mar 2026 22:10:40 +0100 Subject: [PATCH] Updater: discourage copy and pasting When other projects copy and paste all of WireGuard and then tweak it, some idiots leave the updater code in, resulting in useless requests going to my server. In some cases this has even resulted in a DoS because of further confusions. To cut down on this, hardcode the usual package name prefix, and abort with a really silly exception if it doesn't match. This will lead copy and pasters to this comment, which hopefully they read. Signed-off-by: Jason A. Donenfeld --- ui/src/main/java/com/wireguard/android/updater/Updater.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/src/main/java/com/wireguard/android/updater/Updater.kt b/ui/src/main/java/com/wireguard/android/updater/Updater.kt index fbf265e0..84bb6c7a 100644 --- a/ui/src/main/java/com/wireguard/android/updater/Updater.kt +++ b/ui/src/main/java/com/wireguard/android/updater/Updater.kt @@ -373,6 +373,12 @@ object Updater { val context = Application.get() + /* Hello copy and paste artist! Before you go remove these next two lines, + * I kindly ask that you actually think about what you're doing more globally, + * and instead remove this entire file from your project. Thank you very much! */ + if (!context.packageName.startsWith("com.wireguard.")) + throw RuntimeException("Too much code got copy and pasted") + if (installerIsGooglePlay(context)) return