fix(privacy): маскировать -links в логе и не бэкапить логи сессии

Ядро печатает -links, а маска ждала -link - ссылка на звонок уходила в лог открытой.
This commit is contained in:
samosvalishe committed 2026-09-19 23:34:00 +03:00
1 parent 82d3fb8c73
commit 8691c7685b
4 files changed
+34 -2

No files matched your search

@@ -3,8 +3,7 @@ package com.freeturn.app.data
/** Разбор argv-строки от ядра (`Mobile.configToArgs`) для показа пользователю. */
object CoreCommand {
// Лог виден на экране и шарится пользователем.
private val SENSITIVE_FLAGS = setOf("-peer", "-link", "-obf-key", "-turn", "-client-id")
private val SENSITIVE_FLAGS = setOf("-peer", "-links", "-obf-key", "-turn", "-client-id", "-sub")
private const val MASK = "••••••"
+2
View File
@@ -4,4 +4,6 @@
<!-- DataStore хранит профили с SSH-секретами в открытом виде - не бэкапим.
Перенос - через зашифрованный паролем экспорт/импорт. -->
<exclude domain="file" path="datastore/"/>
<!-- Лог сессии: при выключенной приватности в нём peer, ссылка VK, obf-ключ. -->
<exclude domain="file" path="logs/"/>
</full-backup-content>
@@ -4,8 +4,12 @@
<!-- DataStore хранит профили с SSH-секретами в открытом виде - в облако не отдаём.
Перенос на новое устройство - через зашифрованный паролем экспорт/импорт. -->
<exclude domain="file" path="datastore/"/>
<!-- Лог сессии: при выключенной приватности в нём peer, ссылка VK, obf-ключ. -->
<exclude domain="file" path="logs/"/>
</cloud-backup>
<device-transfer>
<exclude domain="file" path="datastore/"/>
<!-- Лог сессии: при выключенной приватности в нём peer, ссылка VK, obf-ключ. -->
<exclude domain="file" path="logs/"/>
</device-transfer>
</data-extraction-rules>
@@ -0,0 +1,27 @@
package com.freeturn.app.data
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class CoreCommandTest {
// Строка в формате Mobile.configToArgs.
private val argv = "-peer 1.2.3.4:56000 -links https://vk.com/call/join/secret " +
"-obf-profile rtpopus -obf-key 00ff -turn 5.6.7.8 -client-id abcd -sub https://sub"
@Test
fun masksEverySecretFlag() {
val out = CoreCommand.redact(argv, privacy = true)
listOf("1.2.3.4", "vk.com", "00ff", "5.6.7.8", "abcd", "https://sub").forEach {
assertFalse("leaked $it", out.contains(it))
}
assertTrue(out.contains("-obf-profile rtpopus"))
}
@Test
fun keepsLineWithoutPrivacy() {
assertEquals(argv, CoreCommand.redact(argv, privacy = false))
}
}