Skip to content

Commit

Permalink
tests/fsck: add malleable_base64 test filesystem
Browse files Browse the repository at this point in the history
This filesystem contains filenames with non-canonical base64
encodings of the same name "foo", leading to this mess:

$ ls mnt/
foo  foo  foo  foo
  • Loading branch information
rfjakob committed Sep 15, 2023
1 parent 8b1c4b0 commit 30c0fbd
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/fsck/fsck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ func TestBrokenFsV14(t *testing.T) {
}
}

func TestMalleableBase64(t *testing.T) {
cmd := exec.Command(test_helpers.GocryptfsBinary, "-fsck", "-extpass", "echo test", "malleable_base64")
outBin, err := cmd.CombinedOutput()
out := string(outBin)
t.Log(out)
code := test_helpers.ExtractCmdExitCode(err)
if code != exitcodes.FsckErrors {
t.Errorf("wrong exit code, have=%d want=%d", code, exitcodes.FsckErrors)
}
}

func TestExampleFses(t *testing.T) {
dirfd, err := os.Open("../example_filesystems")
if err != nil {
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
20 changes: 20 additions & 0 deletions tests/fsck/malleable_base64/gocryptfs.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Creator": "gocryptfs v2.4.0-dirty",
"EncryptedKey": "3RHFBE1hurYP6D4VsdqhQb3Bd/kd3vYsZohgpc2lDhwIM8lsk8FHOgZEtfG2HfEFsV374B6rktbXmrBBiperqw==",
"ScryptObject": {
"Salt": "9pQrdZWjpp1cTjuWNB/SqcLw+HOYeOTECga2yIpjjUU=",
"N": 1024,
"R": 8,
"P": 1,
"KeyLen": 32
},
"Version": 2,
"FeatureFlags": [
"HKDF",
"GCMIV128",
"DirIV",
"EMENames",
"LongNames",
"Raw64"
]
}
1 change: 1 addition & 0 deletions tests/fsck/malleable_base64/gocryptfs.diriv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cTh{��EfDb��ի�

0 comments on commit 30c0fbd

Please sign in to comment.