Skip to content

Commit 3ff7710

Browse files
committed
Improve ExplicitIntent's QLDoc
1 parent fe2755c commit 3ff7710

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

java/ql/lib/semmle/code/java/frameworks/android/Intent.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,17 @@ class AndroidBundle extends Class {
8787
AndroidBundle() { this.getASupertype*().hasQualifiedName("android.os", "BaseBundle") }
8888
}
8989

90-
/** An `Intent` that explicitly sets a destination component. */
90+
/**
91+
* An `Intent` that explicitly sets a destination component.
92+
*
93+
* The `Intent` is not considered explicit if a `null` value ever flows to the destination
94+
* component, even if only conditionally.
95+
*
96+
* For example, in the following code, `intent` is not considered an `ExplicitIntent`:
97+
* ```java
98+
* intent.setClass(condition ? null : "MyClass");
99+
* ```
100+
*/
91101
class ExplicitIntent extends Expr {
92102
ExplicitIntent() {
93103
exists(MethodAccess ma, Method m |

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ private class MutablePendingIntentFlowStep extends PendingIntentAsFieldAdditiona
9494
node2.asExpr() = pic and
9595
flagArg = pic.getFlagsArg()
9696
|
97-
// We err on the side of false positives here, assuming a PendingIntent may be mutable unless it is at
98-
// least sometimes explicitly marked immutable and never marked mutable.
99-
// Note for API level < 31, PendingIntents were mutable by default, whereas since then they are immutable by default.
97+
// We err on the side of false positives here, assuming a PendingIntent may be mutable
98+
// unless it is at least sometimes explicitly marked immutable and never marked mutable.
99+
// Note: for API level < 31, PendingIntents were mutable by default, whereas since then
100+
// they are immutable by default.
100101
not TaintTracking::localExprTaint(any(ImmutablePendingIntentFlag flag).getAnAccess(), flagArg)
101102
or
102103
TaintTracking::localExprTaint(any(MutablePendingIntentFlag flag).getAnAccess(), flagArg)

0 commit comments

Comments
 (0)