Skip to content

Commit 9968d5d

Browse files
Jami CogswellJami Cogswell
authored andcommitted
updated predicates
1 parent 115f76a commit 9968d5d

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
/** Provides a class to reason about Android implicitly exported components. */
1+
/** Provides a class to identify implicitly exported Android components. */
22

33
private import semmle.code.xml.AndroidManifest
44

5+
/** Represents an implicitly exported Android component */
56
class ImplicitlyExportedAndroidComponent extends AndroidComponentXmlElement {
6-
//ImplicitlyExportedAndroidComponent() { }
7+
// ImplicitlyExportedAndroidComponent() {
8+
// not this.hasExportedAttribute() and
9+
// this.hasAnIntentFilterElement() and
10+
// not this.requiresPermissions() and
11+
// not this.getParent().(AndroidApplicationXmlElement).hasAttribute("permission") and
12+
// not this.getAnIntentFilterElement().hasLauncherCategoryElement() and
13+
// not this.getFile().(AndroidManifestXmlFile).isInBuildDirectory()
14+
// }
15+
/**
16+
* Holds if this Android component is implicitly exported.
17+
*/
718
predicate isImplicitlyExported() {
819
not this.hasExportedAttribute() and
920
this.hasAnIntentFilterElement() and

java/ql/lib/semmle/code/xml/AndroidManifest.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class AndroidComponentXmlElement extends XmlElement {
178178
/**
179179
* Holds if this component element has an `<intent-filter>` child element.
180180
*/
181-
predicate hasAnIntentFilterElement() { this.getAChild().hasName("intent-filter") }
181+
predicate hasAnIntentFilterElement() { exists(this.getAnIntentFilterElement()) }
182182

183183
/**
184184
* Gets the value of the `android:name` attribute of this component element.

java/ql/src/Security/CWE/CWE-926/ImplicitlyExportedAndroidComponent.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ import semmle.code.java.security.ImplicitlyExportedAndroidComponent
1616
from ImplicitlyExportedAndroidComponent impExpAndroidComp
1717
where impExpAndroidComp.isImplicitlyExported()
1818
select impExpAndroidComp, "This component is implicitly exported."
19+
// from ImplicitlyExportedAndroidComponent impExpAndroidComp
20+
// where exists(impExpAndroidComp)
21+
// select impExpAndroidComp, "This component is implicitly exported."

0 commit comments

Comments
 (0)