Skip to content

Commit a4e61a1

Browse files
committed
Fixed start on boot regression reported in #1502, added checks in on boot receiver for intent action to restrict what can start orbotservice to legit boot events
1 parent 76a8ae4 commit a4e61a1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/src/main/java/org/torproject/android/receivers/OnBootReceiver.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import java.lang.RuntimeException
1313
class OnBootReceiver : BroadcastReceiver() {
1414
override fun onReceive(context: Context, intent: Intent) {
1515
try {
16+
if (intent.action != "android.intent.action.QUICKBOOT_POWERON" &&
17+
intent.action != "android.intent.action.BOOT_COMPLETED")
18+
return
19+
1620
if (Build.FINGERPRINT.contains("sdk_gphone")) {
1721
// on pixels emulated in new android studio on boot
1822
// gets launched every time you click run. this is annoying
@@ -38,7 +42,7 @@ class OnBootReceiver : BroadcastReceiver() {
3842
else {
3943
context.startService(intent)
4044
}
41-
} catch (re: RuntimeException) {
45+
} catch (_: RuntimeException) {
4246
//catch this to avoid malicious launches as document Cure53 Audit: ORB-01-009 WP1/2: Orbot DoS via exported activity (High)
4347
}
4448
}

app/src/main/java/org/torproject/android/service/OrbotService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ public void run() {
651651
transport.start(OrbotService.this);
652652
startTor();
653653
replyWithStatus(mIntent);
654-
if (!Prefs.useVpn()) {
654+
if (Prefs.useVpn()) {
655655
if (mVpnManager != null && !mVpnManager.isStarted()) { // start VPN here
656656
Intent vpnIntent = VpnService.prepare(OrbotService.this);
657657
if (vpnIntent == null) { //then we can run the VPN

0 commit comments

Comments
 (0)