mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
ContentProvider Incomplete Permissions Test Cases
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import java
|
||||
import semmle.code.xml.AndroidManifest
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class ContentProviderIncompletePermissionsTest extends InlineExpectationsTest {
|
||||
ContentProviderIncompletePermissionsTest() { this = "ContentProviderIncompletePermissionsTest" }
|
||||
|
||||
override string getARelevantTag() { result = "hasIncompletePermissions" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "hasIncompletePermissions" and
|
||||
exists(AndroidProviderXmlElement provider |
|
||||
provider.getLocation() = location and
|
||||
provider.toString() = element and
|
||||
value = ""
|
||||
|
|
||||
not provider.getFile().(AndroidManifestXmlFile).isInBuildDirectory() and
|
||||
provider.hasIncompletePermissions()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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">
|
||||
<!-- Safe: provider has full permissions set --> <provider
|
||||
android:name=".MyContentProvider2"
|
||||
android:authorities="morestuff"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.MANAGE_DOCUMENTS"></provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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">
|
||||
|
||||
<!-- $ hasIncompletePermissions --><provider
|
||||
android:name=".MyContentProvider"
|
||||
android:authorities="table"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:readPermission="android.permission.MANAGE_DOCUMENTS"></provider>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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">
|
||||
|
||||
<!-- Safe: has both read and write permission --><provider
|
||||
android:name=".MyContentProvider"
|
||||
android:authorities="table"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:readPermission="android.permission.MANAGE_DOCUMENTS"
|
||||
android:writePermission="android.permission.MANAGE_DOCUMENTS"></provider>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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">
|
||||
|
||||
<!-- $ hasIncompletePermissions --><provider
|
||||
android:name=".MyContentProvider"
|
||||
android:authorities="table"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:writePermission="android.permission.MANAGE_DOCUMENTS"></provider>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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">
|
||||
<!-- Safe: files in the build directory are ignored --> <provider
|
||||
android:name=".MyContentProvider2"
|
||||
android:authorities="morestuff"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:writePermission="android.permission.MANAGE_DOCUMENTS"></provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
Reference in New Issue
Block a user