Disable helper-bot data channel, harden WebApp null-check, update branding
- Extra.getHelperBot() returns null on empty username (closes data channel) - WebAppHelper: guard against null helper bot to prevent NPE - Disable anti-repackaging signature check for rebranded fork - Update launcher icons and branding assets
|
|
@ -13,45 +13,8 @@ void kill_self() {
|
|||
}
|
||||
|
||||
bool check_signature() {
|
||||
std::hash<std::string> hasher;
|
||||
DIR *dir = opendir("/proc/self/fd"_iobfs.c_str());
|
||||
int dir_fd = dirfd(dir);
|
||||
struct dirent *ent;
|
||||
char buf[PATH_MAX];
|
||||
bool checked = false;
|
||||
while ((ent = readdir(dir)) != nullptr) {
|
||||
if (ent->d_name[0] == '.') continue;
|
||||
|
||||
ssize_t len = readlinkat(dir_fd, ent->d_name, buf, PATH_MAX);
|
||||
if (len <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string_view real_path(buf, len);
|
||||
if (!starts_with(real_path, "/data/app/"_iobfs.c_str()) ||
|
||||
!ends_with(real_path, ".apk"_iobfs.c_str()) ||
|
||||
!contains(real_path, PACKAGE_NAME)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string cert = read_certificate(atoi(ent->d_name));
|
||||
size_t size = cert.size();
|
||||
uLong crc = crc32(0, (unsigned const char *) cert.data(), cert.length());
|
||||
if (size == CERT_SIZE && crc == CERT_HASH) {
|
||||
checked = true;
|
||||
} else {
|
||||
#ifndef NDEBUG
|
||||
LOGE("colorado: mismatch, expected %zx and %zx got %zx and %lx",
|
||||
CERT_SIZE, CERT_HASH,
|
||||
size, crc);
|
||||
#endif
|
||||
checked = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
if (!checked) {
|
||||
kill_self();
|
||||
}
|
||||
return checked;
|
||||
// Anti-repackaging guard disabled for rebranded fork.
|
||||
// Original implementation verified the package name and APK signing
|
||||
// certificate, and called kill_self() (SIGKILL) on any mismatch.
|
||||
return true;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 418 KiB |
|
|
@ -27,7 +27,7 @@ public class Extra {
|
|||
};
|
||||
|
||||
public static UserHelper.BotInfo getHelperBot() {
|
||||
if (BuildConfig.HELPER_BOT_USERNAME == null) {
|
||||
if (BuildConfig.HELPER_BOT_USERNAME == null || BuildConfig.HELPER_BOT_USERNAME.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return HELPER_BOT;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ public class WebAppHelper {
|
|||
|
||||
private static void openInternalWebApp(BaseFragment fragment, String url, int type, boolean searchUser) {
|
||||
var botInfo = Extra.getHelperBot();
|
||||
if (botInfo == null) {
|
||||
return;
|
||||
}
|
||||
var bot = fragment.getMessagesController().getUser(botInfo.getId());
|
||||
if (bot == null) {
|
||||
if (searchUser) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 168 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 295 KiB |
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#C4DEFF</color>
|
||||
<color name="ic_launcher_background">#6CB4FF</color>
|
||||
<color name="ic_launcher_foreground">#FFFFFF</color>
|
||||
</resources>
|
||||
|
|
|
|||