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 2
2
3
3
private import semmle.code.xml.AndroidManifest
4
4
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
+ */
6
9
class ImplicitlyExportedAndroidComponent extends AndroidComponentXmlElement {
7
10
ImplicitlyExportedAndroidComponent ( ) {
8
11
this .hasAnIntentFilterElement ( ) and
9
12
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.
10
16
not this .getAnIntentFilterElement ( ) .getACategoryElement ( ) .getCategoryName ( ) =
11
17
"android.intent.category.LAUNCHER" and
12
18
not this .getAnIntentFilterElement ( ) .getAnActionElement ( ) .getActionName ( ) =
13
19
"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.
14
23
not this .requiresPermissions ( ) and
15
24
not this .getParent ( ) .( AndroidApplicationXmlElement ) .requiresPermissions ( ) and
16
25
not this .getFile ( ) .( AndroidManifestXmlFile ) .isInBuildDirectory ( )
Original file line number Diff line number Diff line change 7
7
* @id java/android/implicitly-exported-component
8
8
* @tags security
9
9
* external/cwe/cwe-926
10
- * @precision medium
10
+ * @precision high
11
11
*/
12
12
13
13
import java
You can’t perform that action at this time.
0 commit comments