From 30c0fbd98ab3606956ea4cf9b99825b942ebe94c Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 21 Jul 2023 17:23:39 +0200 Subject: tests/fsck: add malleable_base64 test filesystem This filesystem contains filenames with non-canonical base64 encodings of the same name "foo", leading to this mess: $ ls mnt/ foo foo foo foo --- tests/fsck/fsck_test.go | 11 +++++++++++ .../fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\ng" | 0 .../fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\rg" | 0 tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zg | 0 tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zh | 0 tests/fsck/malleable_base64/gocryptfs.conf | 20 ++++++++++++++++++++ tests/fsck/malleable_base64/gocryptfs.diriv | 1 + 7 files changed, 32 insertions(+) create mode 100644 "tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\ng" create mode 100644 "tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\rg" create mode 100644 tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zg create mode 100644 tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zh create mode 100644 tests/fsck/malleable_base64/gocryptfs.conf create mode 100644 tests/fsck/malleable_base64/gocryptfs.diriv (limited to 'tests/fsck') diff --git a/tests/fsck/fsck_test.go b/tests/fsck/fsck_test.go index cebc86b..b70fd49 100644 --- a/tests/fsck/fsck_test.go +++ b/tests/fsck/fsck_test.go @@ -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 { diff --git "a/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\ng" "b/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\ng" new file mode 100644 index 0000000..e69de29 diff --git "a/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\rg" "b/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\rg" new file mode 100644 index 0000000..e69de29 diff --git a/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zg b/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zg new file mode 100644 index 0000000..e69de29 diff --git a/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zh b/tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_zh new file mode 100644 index 0000000..e69de29 diff --git a/tests/fsck/malleable_base64/gocryptfs.conf b/tests/fsck/malleable_base64/gocryptfs.conf new file mode 100644 index 0000000..6098756 --- /dev/null +++ b/tests/fsck/malleable_base64/gocryptfs.conf @@ -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" + ] +} diff --git a/tests/fsck/malleable_base64/gocryptfs.diriv b/tests/fsck/malleable_base64/gocryptfs.diriv new file mode 100644 index 0000000..d8a6e22 --- /dev/null +++ b/tests/fsck/malleable_base64/gocryptfs.diriv @@ -0,0 +1 @@ +cTh{½ÚEfDbúüÕ«Û \ No newline at end of file -- cgit v1.2.3