mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Merge pull request #10865 from egregius313/egregius313/android-activity-alias
Java: Add library support for activity-alias elements in AndroidManifest.qll
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.myapplication">
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
|
||||
android:theme="@style/Theme.MyApplication"
|
||||
tools:targetApi="31">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.MyApplication.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".AnotherActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.MyApplication.NoActionBar">
|
||||
</activity>
|
||||
|
||||
|
||||
<activity-alias
|
||||
android:name=".MainAlias"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:targetActivity=".MainActivity"></activity-alias>
|
||||
|
||||
<activity-alias
|
||||
android:name=".SecondAlias"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:targetActivity=".MainActivity"></activity-alias>
|
||||
|
||||
<activity-alias
|
||||
android:name=".AnotherAlias"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:targetActivity="com.example.myapplication.AnotherActivity"></activity-alias>
|
||||
<activity
|
||||
android:name=".ExampleActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/app_name"
|
||||
></activity>
|
||||
|
||||
<activity-alias
|
||||
android:name=".ExampleAlias"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:targetActivity=".ExampleActivity">
|
||||
</activity-alias>
|
||||
|
||||
<activity
|
||||
android:name=".Example2Activity"
|
||||
android:exported="false"
|
||||
android:label="@string/app_name">
|
||||
</activity>
|
||||
|
||||
<activity-alias
|
||||
android:name=".Example2Alias"
|
||||
android:label="@string/app_name"
|
||||
android:targetActivity=".Example2Activity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"></action>
|
||||
<action android:name="android.intent.category.LAUNCHER"></action>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public class Example2Activity extends Activity {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public class ExampleActivity extends Activity {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
| .AnotherAlias | .AnotherActivity |
|
||||
| .Example2Alias | .Example2Activity |
|
||||
| .ExampleAlias | .ExampleActivity |
|
||||
| .MainAlias | .MainActivity |
|
||||
| .SecondAlias | .MainActivity |
|
||||
@@ -0,0 +1,5 @@
|
||||
import java
|
||||
import semmle.code.xml.AndroidManifest
|
||||
|
||||
from AndroidActivityAliasXmlElement alias
|
||||
select alias.getComponentName(), alias.getTarget().getComponentName()
|
||||
@@ -0,0 +1,4 @@
|
||||
| Example2Activity.java:5:14:5:29 | Example2Activity | AndroidManifest.xml:68:9:72:20 | activity |
|
||||
| Example2Activity.java:5:14:5:29 | Example2Activity | AndroidManifest.xml:74:9:82:26 | activity-alias |
|
||||
| ExampleActivity.java:5:14:5:28 | ExampleActivity | AndroidManifest.xml:55:9:59:25 | activity |
|
||||
| ExampleActivity.java:5:14:5:28 | ExampleActivity | AndroidManifest.xml:61:9:66:26 | activity-alias |
|
||||
@@ -0,0 +1,6 @@
|
||||
import java
|
||||
import semmle.code.java.frameworks.android.Android
|
||||
|
||||
from ExportableAndroidComponent component
|
||||
where component.isExported()
|
||||
select component, component.getAndroidComponentXmlElement()
|
||||
@@ -0,0 +1 @@
|
||||
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/google-android-9.0.0/
|
||||
Reference in New Issue
Block a user