libgocryptfs/tests
DerDonut a611810ff4 Badname file content access
This proposal is the counterpart of the modifications from the `-badname`
parameter. It modifies the plain -> cipher mapping for filenames when using
`-badname` parameter. The new function `EncryptAndHashBadName` tries to find a
cipher filename for the given plain name with the following steps:

1. If `badname` is disabled or direct mapping is successful: Map directly
(default and current behaviour)

2. If a file with badname flag has a valid cipher file, this is returned
(=File just ends with the badname flag)

3. If a file with a badname flag exists where only the badname flag was added,
this is returned (=File cipher name could not be decrypted by function
`DecryptName` and just the badname flag was added)

4. Search for all files which cipher file name extists when cropping more and
more characters from the end. If only 1 file is found, return this

5. Return an error otherwise

This allows file access in the file browsers but most important it allows that
you rename files with undecryptable cipher names in the plain directories.
Renaming those files will then generate a proper cipher filename One
backdraft: When mounting the cipher dir with -badname parameter, you can never
create (or rename to) files whose file name ends with the badname file flag
(at the moment this is " GOCRYPTFS_BAD_NAME"). This will cause an error.

I modified the CLI test function to cover additional test cases. Test [Case
7](https://github.com/DerDonut/gocryptfs/blob/badnamecontent/tests/cli/cli_test.go#L712)
cannot be performed since the cli tests are executed in panic mode. The
testing is stopped on error. Since the function`DecryptName` produces internal
errors when hitting non-decryptable file names, this test was omitted.

This implementation is a proposal where I tried to change the minimum amount
of existing code. Another possibility would be instead of creating the new
function `EncryptAndHashBadName` to modify the signature of the existing
function `EncryptAndHashName(name string, iv []byte)` to
`EncryptAndHashName(name string, iv []byte, dirfd int)` and integrate the
functionality into this function directly. You may allow calling with dirfd=-1
or other invalid values an then performing the current functionality.
2021-06-20 18:09:21 +02:00
..
cli Badname file content access 2021-06-20 18:09:21 +02:00
defaults fusefrontend: do not encrypt ACLs 2021-02-07 20:01:16 +01:00
example_filesystems nametransform: check name validity on encryption 2021-06-02 14:29:48 +02:00
fsck v2api: fsck: use a temporary mount 2020-07-19 23:03:47 +02:00
hkdf_sanity tests: add hkdf_sanity tests with broken example filesystem 2017-03-18 16:48:58 +01:00
matrix fusefronted: report plaintext size on symlink creation 2021-06-06 19:22:16 +02:00
plaintextnames tests: TestFileHoleCopy: accept +-4kB 2021-05-29 16:56:20 +02:00
reverse tests/reverse: implement (skipped) xattr test 2020-08-30 16:36:10 +02:00
root_test Add -acl flag to enable ACL enforcement 2021-05-15 17:58:37 +02:00
sharedstorage tests: sharedstorage: wait 100ms longer for cache expiry 2021-04-02 20:22:26 +02:00
stress_tests tests: fsstress-gocryptfs.bash: log timestamp for each iteration 2020-10-04 00:12:46 +02:00
symlink_race tests: add symlink_race tool 2018-09-23 12:17:26 +02:00
test_helpers test_helpers: VerifySize: don't complain about ino mismatch 2021-03-21 10:53:51 +01:00
xattr tests/xattr: fix acl blob 2021-02-07 20:00:33 +01:00
canonical-benchmarks.bash benchmarks: add streaming read benchmark 2017-06-27 00:04:58 +02:00
dl-linux-tarball.bash macos: tests: use curl of wget is not available 2018-03-07 09:40:48 +01:00
fuse-unmount.bash Assorted spelling fixes. 2018-12-27 15:19:55 +01:00
len2elen.sh test: len2elen.sh: fix first line output 2019-02-17 16:06:05 +01:00
sshfs-benchmark.bash sshfs-benchmark.bash: fix locale trouble and move to tests 2020-06-06 12:15:41 +02:00