feat(android): implement private Rust storage runtime (#90)
Dependency security audit / rustsec (push) Failing after 23s

This commit is contained in:
hugo committed 2026-10-08 14:36:05 +02:00
1 parent 180851087b
commit 874c8139a4
36 files changed
+2848 -39

No files matched your search

@@ -0,0 +1,42 @@
package de.rfc1437.ironstorage
import android.content.pm.ApplicationInfo
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Test
import org.xmlpull.v1.XmlPullParser
class BackupPolicyTest {
@Test
fun installedResourcesExcludeCredentialAndDeviceProtectedDomains() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals(0, context.applicationInfo.flags and ApplicationInfo.FLAG_ALLOW_BACKUP)
val domains = setOf(
"root", "file", "database", "sharedpref", "external",
"device_root", "device_file", "device_database", "device_sharedpref"
)
for ((resource, sections) in mapOf(
R.xml.backup_rules to setOf("full-backup-content"),
R.xml.data_extraction_rules to setOf("cloud-backup", "device-transfer")
)) {
context.resources.getXml(resource).use { xml ->
val excluded = mutableMapOf<String, MutableSet<String>>()
var section = ""
while (xml.eventType != XmlPullParser.END_DOCUMENT) {
if (xml.eventType == XmlPullParser.START_TAG) {
if (xml.name in sections) section = xml.name
assertFalse(xml.name == "include")
if (xml.name == "exclude") {
assertEquals(".", xml.getAttributeValue(null, "path"))
excluded.getOrPut(section) { mutableSetOf() }
.add(xml.getAttributeValue(null, "domain"))
}
}
xml.next()
}
assertEquals(sections.associateWith { domains }, excluded)
}
}
}
}
@@ -8,6 +8,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import de.rfc1437.ironstorage.core.NativeFixtureShellRepository
import de.rfc1437.ironstorage.core.ShellRepository
import de.rfc1437.ironstorage.platform.privateDirectories
import javax.inject.Singleton
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -21,6 +22,7 @@ object ShellModule {
fun shellRepository(@ApplicationContext context: Context): ShellRepository =
NativeFixtureShellRepository(
context,
CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate),
{ privateDirectories(context) }
)
}
@@ -4,4 +4,8 @@
<exclude domain="database" path="." />
<exclude domain="sharedpref" path="." />
<exclude domain="external" path="." />
<exclude domain="device_root" path="." />
<exclude domain="device_file" path="." />
<exclude domain="device_database" path="." />
<exclude domain="device_sharedpref" path="." />
</full-backup-content>
@@ -5,6 +5,10 @@
<exclude domain="database" path="." />
<exclude domain="sharedpref" path="." />
<exclude domain="external" path="." />
<exclude domain="device_root" path="." />
<exclude domain="device_file" path="." />
<exclude domain="device_database" path="." />
<exclude domain="device_sharedpref" path="." />
</cloud-backup>
<device-transfer>
<exclude domain="root" path="." />
@@ -12,5 +16,9 @@
<exclude domain="database" path="." />
<exclude domain="sharedpref" path="." />
<exclude domain="external" path="." />
<exclude domain="device_root" path="." />
<exclude domain="device_file" path="." />
<exclude domain="device_database" path="." />
<exclude domain="device_sharedpref" path="." />
</device-transfer>
</data-extraction-rules>