mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
resolved merge conflict in AndroidManifest
This commit is contained in:
@@ -67,6 +67,9 @@ class AndroidApplicationXmlElement extends XmlElement {
|
||||
attr.getValue() = "true"
|
||||
)
|
||||
}
|
||||
|
||||
/** Holds if this component element has an attribute with the name `permission`. */
|
||||
predicate hasPermissionAttribute() { exists(this.getAttribute("permission")) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,6 +173,11 @@ class AndroidComponentXmlElement extends XmlElement {
|
||||
*/
|
||||
AndroidIntentFilterXmlElement getAnIntentFilterElement() { result = this.getAChild() }
|
||||
|
||||
/**
|
||||
* Holds if this component element has an `<intent-filter>` child element.
|
||||
*/
|
||||
predicate hasAnIntentFilterElement() { this.getAChild().hasName("intent-filter") }
|
||||
|
||||
/**
|
||||
* Gets the value of the `android:name` attribute of this component element.
|
||||
*/
|
||||
@@ -220,6 +228,23 @@ class AndroidComponentXmlElement extends XmlElement {
|
||||
* Holds if the `android:exported` attribute of this component element is explicitly set to `false`.
|
||||
*/
|
||||
predicate isNotExported() { this.getExportedAttributeValue() = "false" }
|
||||
|
||||
/**
|
||||
* Holds if this component element has an `android:exported` attribute.
|
||||
*/
|
||||
predicate hasExportedAttribute() { this.hasAttribute("exported") }
|
||||
|
||||
/** Holds if this component element has an attribute with the name `permission`. */
|
||||
predicate hasPermissionAttribute() { exists(this.getAttribute("permission")) }
|
||||
|
||||
predicate isImplicitlyExported() {
|
||||
not this.hasExportedAttribute() and
|
||||
this.hasAnIntentFilterElement() and // Note: did not use getAnIntentFilterElement since don't need a return value
|
||||
not this.hasPermissionAttribute() and
|
||||
not this.getParent().(AndroidApplicationXmlElement).hasPermissionAttribute() and
|
||||
not this.getAnIntentFilterElement().hasLauncherCategoryElement() and
|
||||
not this.getFile().(AndroidManifestXmlFile).isInBuildDirectory()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,6 +259,19 @@ class AndroidIntentFilterXmlElement extends XmlElement {
|
||||
* Gets an `<action>` child element of this `<intent-filter>` element.
|
||||
*/
|
||||
AndroidActionXmlElement getAnActionElement() { result = this.getAChild() }
|
||||
|
||||
/**
|
||||
* Gets a `<category>` child element of this `<intent-filter>` element.
|
||||
*/
|
||||
AndroidCategoryXmlElement getACategoryElement() { result = this.getAChild("category") }
|
||||
|
||||
/**
|
||||
* Holds if this `<intent-filter>` element has a `<category>` child element
|
||||
* named "android.intent.category.LAUNCHER".
|
||||
*/
|
||||
predicate hasLauncherCategoryElement() {
|
||||
this.getACategoryElement().getAttributeValue("name") = "android.intent.category.LAUNCHER"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,3 +295,25 @@ class AndroidActionXmlElement extends XmlElement {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A `<category>` element in an Android manifest file.
|
||||
*/
|
||||
class AndroidCategoryXmlElement extends XMLElement {
|
||||
AndroidCategoryXmlElement() {
|
||||
this.getFile() instanceof AndroidManifestXmlFile and this.getName() = "category"
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this category.
|
||||
*/
|
||||
string getCategoryName() {
|
||||
exists(XMLAttribute attr |
|
||||
attr = this.getAnAttribute() and
|
||||
attr.getNamespace().getPrefix() = "android" and
|
||||
attr.getName() = "name"
|
||||
|
|
||||
result = attr.getValue()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user