mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Add support for Android Manifest <activity-alias> element
This commit is contained in:
@@ -131,6 +131,35 @@ class AndroidActivityXmlElement extends AndroidComponentXmlElement {
|
||||
AndroidActivityXmlElement() { this.getName() = "activity" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An `<activity-alias>` element in an Android manifest file.
|
||||
*/
|
||||
class AndroidActivityAliasXmlElement extends AndroidComponentXmlElement {
|
||||
AndroidActivityAliasXmlElement() { this.getName() = "activity-alias" }
|
||||
|
||||
/**
|
||||
* Get and resolve the name of the target activity from the `android:targetActivity` attribute.
|
||||
*/
|
||||
string getResolvedTargetActivityName() {
|
||||
exists(AndroidXmlAttribute attr |
|
||||
attr = this.getAnAttribute() and attr.getName() = "targetActivity"
|
||||
|
|
||||
result = getResolvedIdentifier(attr)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `<activity>` element referenced by the `android:targetActivity` attribute.
|
||||
*/
|
||||
AndroidActivityXmlElement getTarget() {
|
||||
exists(AndroidActivityXmlElement activity |
|
||||
activity.getResolvedComponentName() = this.getResolvedTargetActivityName()
|
||||
|
|
||||
result = activity
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A `<service>` element in an Android manifest file.
|
||||
*/
|
||||
@@ -235,7 +264,7 @@ class AndroidPathPermissionXmlElement extends XmlElement {
|
||||
class AndroidComponentXmlElement extends XmlElement {
|
||||
AndroidComponentXmlElement() {
|
||||
this.getParent() instanceof AndroidApplicationXmlElement and
|
||||
this.getName().regexpMatch("(activity|service|receiver|provider)")
|
||||
this.getName().regexpMatch("(activity|activity-alias|service|receiver|provider)")
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user