File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
lib/semmle/code/java/security Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 22
33private import semmle.code.xml.AndroidManifest
44
5- /** An implicitly exported Android component */
5+ /**
6+ * An Android component without an `exported` attribute explicitly set
7+ * that also has an `intent-filter` element.
8+ */
69class ImplicitlyExportedAndroidComponent extends AndroidComponentXmlElement {
710 ImplicitlyExportedAndroidComponent ( ) {
811 this .hasAnIntentFilterElement ( ) and
912 not this .hasExportedAttribute ( ) and
13+ // Components with category LAUNCHER or with action MAIN need to be exported since
14+ // they are entry-points to the application. As a result, we do not consider these
15+ // components to be implicitly exported since the developer intends them to be exported anyways.
1016 not this .getAnIntentFilterElement ( ) .getACategoryElement ( ) .getCategoryName ( ) =
1117 "android.intent.category.LAUNCHER" and
1218 not this .getAnIntentFilterElement ( ) .getAnActionElement ( ) .getActionName ( ) =
1319 "android.intent.action.MAIN" and
20+ // The `permission` attribute can be used to limit components' exposure to other applications.
21+ // As a result, we do not consider components with an explicitly set `permission` attribute to be
22+ // implicitly exported since the developer has already limited access to such components.
1423 not this .requiresPermissions ( ) and
1524 not this .getParent ( ) .( AndroidApplicationXmlElement ) .requiresPermissions ( ) and
1625 not this .getFile ( ) .( AndroidManifestXmlFile ) .isInBuildDirectory ( )
Original file line number Diff line number Diff line change 77 * @id java/android/implicitly-exported-component
88 * @tags security
99 * external/cwe/cwe-926
10- * @precision medium
10+ * @precision high
1111 */
1212
1313import java
You can’t perform that action at this time.
0 commit comments