Skip to content

Commit e7983fb

Browse files
committed
Add test and check for another edge case
1 parent bc6c13b commit e7983fb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

java/ql/lib/semmle/code/java/security/AndroidIntentRedirectionQuery.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ private class SameIntentBeingRelaunchedConfiguration extends DataFlow3::Configur
5555
exists(ClassInstanceExpr cie |
5656
cie.getConstructedType() instanceof TypeIntent and
5757
node1.asExpr() = cie.getArgument(0) and
58+
node1.asExpr().getType() instanceof TypeIntent and
5859
node2.asExpr() = cie
5960
)
6061
}

java/ql/test/query-tests/security/CWE-940/AndroidIntentRedirectionTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ public void onCreate(Bundle savedInstanceState) {
146146
anotherIntent.setComponent(cp);
147147
startActivity(originalIntent); // Safe - not a tainted Intent
148148
}
149+
{
150+
Intent originalIntent = getIntent();
151+
Intent anotherIntent = new Intent(originalIntent);
152+
startActivity(anotherIntent); // Safe - copy constructor from original Intent
153+
}
149154
{
150155
Intent originalIntent = getIntent();
151156
Intent fwdIntent = (Intent) originalIntent.getParcelableExtra("forward_intent");

0 commit comments

Comments
 (0)