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
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/receivers/UpgradeReceiver.kt
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@
26
26
*/
27
27
packagecom.onesignal.notifications.receivers
28
28
29
+
importandroid.app.Notification.Action
29
30
importandroid.content.BroadcastReceiver
30
31
importandroid.content.Context
31
32
importandroid.content.Intent
@@ -38,6 +39,10 @@ class UpgradeReceiver : BroadcastReceiver() {
38
39
// TODO: Now that we arent restoring like we use to, think we can remove this? Ill do some
39
40
// testing and look at the issue but maybe someone has a answer or rems what directly
40
41
// was causing this issue
42
+
// Return early if the action does not match expected action
43
+
if (intent.action !=Intent.ACTION_MY_PACKAGE_REPLACED){
44
+
return
45
+
}
41
46
// Return early if using Android 7.0 due to upgrade restore crash (#263)
42
47
if (Build.VERSION.SDK_INT==Build.VERSION_CODES.N) {
0 commit comments