@@ -40,13 +40,23 @@ public void onCreate(Bundle savedInstanceState) {
4040 sendStickyOrderedBroadcastAsUser (intent , null , null , null , 0 , null , null ); // $ hasAndroidIntentRedirection
4141 // @formatter:on
4242
43+ // Sanitizing only the package or the class still allows redirecting
44+ // to non-exported activities in the same package
45+ // or activities with the same name in other packages, respectively.
4346 if (intent .getComponent ().getPackageName ().equals ("something" )) {
44- startActivity (intent ); // Safe - sanitized
47+ startActivity (intent ); // $ hasAndroidIntentRedirection
4548 } else {
4649 startActivity (intent ); // $ hasAndroidIntentRedirection
4750 }
4851 if (intent .getComponent ().getClassName ().equals ("something" )) {
49- startActivity (intent ); // Safe - sanitized
52+ startActivity (intent ); // $ hasAndroidIntentRedirection
53+ } else {
54+ startActivity (intent ); // $ hasAndroidIntentRedirection
55+ }
56+
57+ if (intent .getComponent ().getPackageName ().equals ("something" )
58+ && intent .getComponent ().getClassName ().equals ("something" )) {
59+ startActivity (intent ); // Safe
5060 } else {
5161 startActivity (intent ); // $ hasAndroidIntentRedirection
5262 }
@@ -94,8 +104,7 @@ public void onCreate(Bundle savedInstanceState) {
94104 }
95105 {
96106 Intent fwdIntent = new Intent ();
97- ComponentName component =
98- new ComponentName ("" , intent .getStringExtra ("className" ));
107+ ComponentName component = new ComponentName ("" , intent .getStringExtra ("className" ));
99108 fwdIntent .setComponent (component );
100109 startActivity (fwdIntent ); // $ hasAndroidIntentRedirection
101110 }
0 commit comments