[skip ci] add check gopass config folder with ~
This commit is contained in:
parent
6b5a49f53e
commit
70321a8bf5
2 changed files with 14 additions and 0 deletions
|
@ -42,6 +42,9 @@ fun Prov.installGopass(
|
||||||
|
|
||||||
|
|
||||||
fun Prov.configureGopass(gopassRootFolder: String? = null) = def {
|
fun Prov.configureGopass(gopassRootFolder: String? = null) = def {
|
||||||
|
if ((gopassRootFolder != null) && (gopassRootFolder.trim().length > 0) && ("~" == gopassRootFolder.trim().substring(0, 1))) {
|
||||||
|
return@def ProvResult(false, err = "Gopass cannot be initialized with folders starting with ~")
|
||||||
|
}
|
||||||
val defaultRootFolder = userHome() + ".password-store"
|
val defaultRootFolder = userHome() + ".password-store"
|
||||||
val rootFolder = gopassRootFolder ?: defaultRootFolder
|
val rootFolder = gopassRootFolder ?: defaultRootFolder
|
||||||
// use default
|
// use default
|
||||||
|
|
|
@ -16,10 +16,21 @@ import org.junit.jupiter.api.Test
|
||||||
import org.domaindrivenarchitecture.provs.extensions.test_keys.privateGPGSnakeoilKey
|
import org.domaindrivenarchitecture.provs.extensions.test_keys.privateGPGSnakeoilKey
|
||||||
import org.domaindrivenarchitecture.provs.extensions.test_keys.publicGPGSnakeoilKey
|
import org.domaindrivenarchitecture.provs.extensions.test_keys.publicGPGSnakeoilKey
|
||||||
import org.domaindrivenarchitecture.provs.workplace.infrastructure.*
|
import org.domaindrivenarchitecture.provs.workplace.infrastructure.*
|
||||||
|
import org.junit.jupiter.api.Assertions.assertFalse
|
||||||
|
|
||||||
|
|
||||||
internal class GopassKtTest {
|
internal class GopassKtTest {
|
||||||
|
|
||||||
|
@ContainerTest
|
||||||
|
@Test
|
||||||
|
fun test_configureGopass_fails_with_path_starting_with_tilde() {
|
||||||
|
// when
|
||||||
|
val res = defaultTestContainer().configureGopass("~/somedir")
|
||||||
|
|
||||||
|
// then
|
||||||
|
assertFalse(res.success)
|
||||||
|
}
|
||||||
|
|
||||||
@ContainerTest
|
@ContainerTest
|
||||||
@Test
|
@Test
|
||||||
fun test_installAndConfigureGopassAndMountStore() {
|
fun test_installAndConfigureGopassAndMountStore() {
|
||||||
|
|
Loading…
Reference in a new issue