Skip to content

Commit 2255b0d

Browse files
committed
Modify getAndroidComponentXmlElement to handle activity-alias
Since aliases have both the `name` and `targetActivity` attributes, we should check all identifying attributes in order to add `<activity-alias>` elements as dataflow sources.
1 parent 4620db0 commit 2255b0d

File tree

1 file changed

+6
-1
lines changed
  • java/ql/lib/semmle/code/java/frameworks/android

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ class AndroidComponent extends Class {
2626

2727
/** The XML element corresponding to this Android component. */
2828
AndroidComponentXmlElement getAndroidComponentXmlElement() {
29-
result.getResolvedComponentName() = this.getQualifiedName()
29+
// Find an element with an identifier matching the qualified name of the component.
30+
// Aliases have two identifiers (name and target), so check both identifiers (if present).
31+
exists(AndroidIdentifierXmlAttribute identifier |
32+
identifier = result.getAnAttribute() and
33+
result.getResolvedIdentifier(identifier) = this.getQualifiedName()
34+
)
3035
}
3136

3237
/** Holds if this Android component is configured as `exported` in an `AndroidManifest.xml` file. */

0 commit comments

Comments
 (0)