mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
Change allowBackup tests to use qlref test format
Due to some limitations of comments in XML, it is simpler to implement the `android:allowBackup` tests using the qlref/expectations test format.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| TestExplicitlyEnabled/AndroidManifest.xml:6:5:27:19 | application | The 'android:allowBackup' attribute is enabled. |
|
||||
| TestMissing/AndroidManifest.xml:6:5:27:19 | application | The 'android:allowBackup' attribute is enabled. |
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
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() |
|
||||
androidAppElem.getAttribute("allowBackup").getLocation() = location and
|
||||
element = androidAppElem.getAttribute("debuggable").toString() and
|
||||
value = ""
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Security/CWE/CWE-312/AllowBackupAttributeEnabled.ql
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.myapplication">
|
||||
|
||||
<!-- $ hasAllowBackupEnabled --> <application
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.myapplication">
|
||||
|
||||
<!-- $ hasAllowBackupEnabled --> <application
|
||||
<application
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// semmle-extractor-options: --javac-args -cp ${testdir}/../../../../../stubs/google-android-9.0.0
|
||||
// codeql-extractor-kotlin-options: ${testdir}/../../../../../stubs/google-android-9.0.0
|
||||
Reference in New Issue
Block a user