You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add intent verification to BroadcastReceiver classes
Update onReceive methods to check for correct action before proceeding. This prevents potential risk of third-party applications to send explicit intents to this receiver to cause a denial of service.
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/receivers/BootUpReceiver.kt
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,10 @@ class BootUpReceiver : BroadcastReceiver() {
37
37
context:Context,
38
38
intent:Intent,
39
39
) {
40
+
// Return early if the action does not match expected action
41
+
if (intent.action !=Intent.ACTION_BOOT_COMPLETED) {
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/receivers/UpgradeReceiver.kt
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,10 @@ class UpgradeReceiver : BroadcastReceiver() {
41
41
// TODO: Now that we arent restoring like we use to, think we can remove this? Ill do some
42
42
// testing and look at the issue but maybe someone has a answer or rems what directly
43
43
// was causing this issue
44
+
// Return early if the action does not match expected action
45
+
if (intent.action !=Intent.ACTION_MY_PACKAGE_REPLACED) {
46
+
return
47
+
}
44
48
// Return early if using Android 7.0 due to upgrade restore crash (#263)
45
49
if (Build.VERSION.SDK_INT==Build.VERSION_CODES.N) {
0 commit comments