Unit tests for android:allowBackup query

This commit is contained in:
Ed Minnix
2022-09-06 13:52:43 -04:00
parent 6485e73cd3
commit 0a83cedeb7
4 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
class AllowBackupEnabledTest {
}

View File

@@ -0,0 +1,21 @@
import java
import semmle.code.xml.AndroidManifest
import TestUtilities.InlineExpectationsTest
class AllowBackupEnabledTest extends InlineExpectationsTest {
AllowBackupEnabledTest() { this = "AllowBackupEnabledTest" }
override string getARelevantTag() { result = "hasAllowBackupEnabled" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasAllowedBackupEnabled" and
exists(AndroidApplicationXmlElement androidAppElem |
androidAppElem.allowsBackup() and
not androidAppElem.getFile().(AndroidManifestXmlFile).isInBuildDirectory()
|
androidAppElem.getAttribute("allowBackup").getLocation() = location and
element = androidAppElem.getAttribute("debuggable").toString() and
value = ""
)
}
}

View File

@@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="0.1" >
<application>
<application android:allowBackup="true">
<activity android:name=".CleartextStorageAndroidDatabaseTest"></activity>
<activity android:name=".CleartextStorageAndroidFileSystemTest"></activity>
<activity android:name=".CleartextStorageSharedPrefsTest"></activity>