mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
fix: shared session logs are always scrubbed, whatever their size (#1065)
This commit is contained in:
1 parent
b3122aece0
commit
67ab3fa634
5 files changed
+186
-13
No files matched your search
@@ -32,6 +32,35 @@ class SessionLogShareTest {
|
||||
"rules $rules\n" + files.joinToString("") { val f = File(folder, it); "${f.length()}\t${f.lastModified()}\t$it\n" })
|
||||
}
|
||||
|
||||
@Test fun aLogPastTheInMemoryCapIsStillScrubbedIntoTheZip() {
|
||||
val folder = tmp.newFolder("2026-10-18-01-steam")
|
||||
val line = ("x".repeat(1023) + "\n").toByteArray()
|
||||
File(folder, "session.log").outputStream().buffered().use { out ->
|
||||
out.write("$secret\n".toByteArray())
|
||||
repeat(65 * 1024) { out.write(line) }
|
||||
}
|
||||
assertTrue(File(folder, "session.log").length() >= LogRedactor.IN_MEMORY_SCRUB_MAX)
|
||||
val out = zip(folder)
|
||||
assertTrue(out.containsKey("session.log"))
|
||||
assertFalse(out.getValue("session.log").contains(leaked))
|
||||
}
|
||||
|
||||
@Test fun aLogWithANulByteIsScrubbedNotCopiedRaw() {
|
||||
val folder = tmp.newFolder("2026-10-18-02-steam")
|
||||
File(folder, "crash.log").writeBytes(byteArrayOf(0) + "$secret\n".toByteArray())
|
||||
val out = zip(folder)
|
||||
assertTrue(out.containsKey("crash.log"))
|
||||
assertFalse(out.getValue("crash.log").contains(leaked))
|
||||
}
|
||||
|
||||
@Test fun utf16SecretsDoNotEscapeInTheSharedZip() {
|
||||
val folder = tmp.newFolder("2026-10-18-03-steam")
|
||||
File(folder, "crash.log").writeBytes("sessionid=$leaked".toByteArray(Charsets.UTF_16LE))
|
||||
val output = zip(folder).getValue("crash.log")
|
||||
assertFalse(output.replace("\u0000", "").contains(leaked))
|
||||
assertTrue(output.contains("withheld"))
|
||||
}
|
||||
|
||||
@Test fun aRecordedUnchangedFileIsScrubbedAgainOnTheWayIntoTheZip() {
|
||||
val folder = tmp.newFolder("2026-10-06-01-steam")
|
||||
File(folder, "session.log").writeText("$secret\n")
|
||||
|
||||
Reference in new issue
Block a user