summaryrefslogtreecommitdiff
path: root/tests/cli/cli_test.go
diff options
context:
space:
mode:
authororcas2019-09-15 00:32:54 +0800
committerJakob Unterwurzacher2020-02-28 22:17:59 +0100
commit9ec042f2f62bc95154d6c8b3215a2e7853f8f5c6 (patch)
tree3a2225151361c7f2f51f57b51d613e29d6ce809b /tests/cli/cli_test.go
parenteeefddad6a254607329c08a4ed6051c068283a06 (diff)
Show undecryptable filenames if they match supplied glob
Resolves https://github.com/rfjakob/gocryptfs/issues/393
Diffstat (limited to 'tests/cli/cli_test.go')
-rw-r--r--tests/cli/cli_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go
index 3e1bf42..232c8cc 100644
--- a/tests/cli/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"strconv"
+ "strings"
"syscall"
"testing"
"time"
@@ -644,3 +645,43 @@ func TestSymlinkedCipherdir(t *testing.T) {
t.Errorf("wrong Readdirnames result: %v", names)
}
}
+
+func TestBypass(t *testing.T) {
+ dir := test_helpers.InitFS(t)
+ mnt := dir + ".mnt"
+
+ test_helpers.MountOrFatal(t, dir, mnt, "-badname=*", "-extpass=echo test")
+ defer test_helpers.UnmountPanic(mnt)
+
+ file := mnt + "/file"
+ err := ioutil.WriteFile(file, []byte("somecontent"), 0600)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ invalid_file_name := "invalid_file"
+ invalid_file := dir + "/" + invalid_file_name
+ err = ioutil.WriteFile(invalid_file, []byte("somecontent"), 0600)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ f, err := os.Open(mnt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.Close()
+
+ names, err := f.Readdirnames(0)
+ found := false
+ for _, name := range names {
+ if strings.Contains(name, invalid_file_name) {
+ found = true
+ break
+ }
+ }
+
+ if !found {
+ t.Errorf("did not find invalid name %s in %v", invalid_file_name, names)
+ }
+}