libgocryptfs/internal
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
..
configfile Add support for FIDO2 tokens 2020-09-12 18:06:54 +02:00
contentenc contentenc: add PlainOffToCipherOff helper 2021-05-26 18:28:59 +02:00
cryptocore tlog: stop embedding log.Logger to prevent mistakes 2018-02-28 09:02:18 +01:00
ctlsocksrv ctlsock: create exported ctlsock client library 2020-05-09 17:36:41 +02:00
ensurefds012 main: Run 'ensure fds' code early during the program startup. 2019-01-05 16:12:16 +01:00
exitcodes Add support for FIDO2 tokens 2020-09-12 18:06:54 +02:00
fido2 fido2: quote argument strings in debug output 2021-06-03 22:03:21 +02:00
fusefrontend Badname file content access 2021-06-20 18:09:21 +02:00
fusefrontend_reverse nametransform: check name validity on encryption 2021-06-02 14:29:48 +02:00
inomap v2api: -sharestorage: disable hard link tracking & add tests 2021-03-07 17:22:29 +01:00
nametransform Badname file content access 2021-06-20 18:09:21 +02:00
openfiletable inomap: split into separate package 2020-04-13 14:54:04 +02:00
pathiv pathiv: fix test failure on Go 1.6 2017-05-31 08:21:36 +02:00
readpassword main: accept multiple -passfile options 2020-05-17 19:31:04 +02:00
serialize_reads serialize_reads: drop superflous "continue" 2019-09-08 21:19:44 +02:00
siv_aead siv_aead: create private key copy and implement wiping 2018-02-18 16:01:46 +01:00
speed -speed: note that XChaCha20 is not selectable 2021-05-18 09:53:23 +02:00
stupidgcm stupidgcm: prefer Go stdlib over OpenSSL on Apple M1 2021-05-26 09:20:22 +02:00
syscallcompat syscallcompat: drop obsolete wrappers 2021-06-05 15:06:30 +02:00
tlog fsck: redirect go-fuse noise to syslog 2021-05-18 18:38:23 +02:00