aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/test
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-02 21:31:19 +0100
committerDanilo M. <danix@danix.xyz>2026-11-02 21:31:19 +0100
commit0ba7321ce6b94a0046119e62a7ced8badb5baa5f (patch)
tree8331e14668f8439270254294b52aa038810508a8 /app/src/test
parenta2b27dade21f85b68654245efefbd339c3e59584 (diff)
downloadHardenedPass-0ba7321ce6b94a0046119e62a7ced8badb5baa5f.tar.gz
HardenedPass-0ba7321ce6b94a0046119e62a7ced8badb5baa5f.zip
fix(app): harden store delete, move and rename
- renameFolder stops when the move fails instead of recording and committing - delete runs its file work on the IO dispatcher - folder delete no longer follows directory symlinks (new test) - overwrite dialog is dismissed when its coroutine is cancelled Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'app/src/test')
-rw-r--r--app/src/test/java/app/passwordstore/ui/list/StoreActionsTest.kt29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/src/test/java/app/passwordstore/ui/list/StoreActionsTest.kt b/app/src/test/java/app/passwordstore/ui/list/StoreActionsTest.kt
new file mode 100644
index 00000000..8a1ae1d9
--- /dev/null
+++ b/app/src/test/java/app/passwordstore/ui/list/StoreActionsTest.kt
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+package app.passwordstore.ui.list
+
+import java.io.File
+import java.nio.file.Files
+import kotlin.test.Test
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
+
+class StoreActionsTest {
+
+ @Test
+ fun deleteDoesNotFollowSymlinks() {
+ val root = Files.createTempDirectory("aps").toFile()
+ val outsideDir = File(root, "outside").apply { mkdirs() }
+ val outsideFile = File(outsideDir, "secret.gpg").apply { writeText("x") }
+ val folder = File(root, "store/folder").apply { mkdirs() }
+ File(folder, "login.gpg").writeText("x")
+ Files.createSymbolicLink(File(folder, "link").toPath(), outsideDir.toPath())
+
+ assertTrue(folder.deleteWithoutFollowingLinks())
+
+ assertFalse(folder.exists())
+ assertTrue(outsideFile.exists())
+ }
+}