Skip to content

Commit 5751fc2

Browse files
committed
Java: Reveal false negative in test
One of the sinks was flagged for the wrong reason in the test case. The flow into the 'startActivities' sink isn't working properly, but this was not revealed by the test since an alternate, spurious path exists. The spurious path goes through the implicit read at the prior sink and takes a use-use step to the 'startActivities' sink. Swapping the order of the two sinks reveals the false negative.
1 parent 993bfee commit 5751fc2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
failures
22
testFailures
3+
| ImplicitPendingIntentsTest.java:35:60:35:87 | // $hasImplicitPendingIntent | Missing result:hasImplicitPendingIntent= |

java/ql/test/query-tests/security/CWE-927/ImplicitPendingIntentsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public static void testPendingIntentAsAnExtra(Context ctx)
3232
PendingIntent pi = PendingIntent.getActivity(ctx, 0, baseIntent, 0);
3333
Intent fwdIntent = new Intent();
3434
fwdIntent.putExtra("fwdIntent", pi);
35-
ctx.startActivity(fwdIntent); // $hasImplicitPendingIntent
3635
ctx.startActivities(new Intent[] {fwdIntent}); // $hasImplicitPendingIntent
36+
ctx.startActivity(fwdIntent); // $hasImplicitPendingIntent
3737
ctx.startService(fwdIntent); // Safe
3838
ctx.sendBroadcast(fwdIntent); // $hasImplicitPendingIntent
3939

0 commit comments

Comments
 (0)