WIP: fix(encryption): store key by fileId for CollectiveMountPoint#59343
WIP: fix(encryption): store key by fileId for CollectiveMountPoint#59343mejo- wants to merge 1 commit into
Conversation
Signed-off-by: Jonas <jonas@freesources.org>
|
I agree that storing keys by fileid would be an improvement, as it also removes the need to move the keys on renames etc.
I would be in favor of doing it for all storages, but that obviously makes migration/backwards compatibility harder
Ideally the |
| } | ||
|
|
||
| if ($fileId !== null) { | ||
| $keyPath = $root . '/files_encryption/keys_by_fileId/' . $fileId . '/'; |
There was a problem hiding this comment.
This will run into problems with the number of files in a single directory. Some form of nested directory structure will need to be used to spread things out a bit
There was a problem hiding this comment.
Do you have an idea how we could nest the the files?
What do you think about a 3-level split of a 12-digit zero-padded version of the fileId? I.e. fileId 123 would go to 0000/0000/0123/123/, 987654321 would go to 0009/8765/4321/987654321/, and so on.
$padded = str_pad((string)$fileId, 12, '0', STR_PAD_LEFT);
$path = substr($padded, 0, 4) . '/' . substr($padded, 4, 4) . '/' . substr($padded, 8, 4) . '/' . (string)$fileId;
Summary
In Collectives, we can have different paths to a file by user (when a user changes their
user_folderuser setting). This leads to inaccessible files with server-side encryption as the encryption keys are stored by file path. In order to fix this, we should switch tofileIdbased key storage instead of file path based key storage.TODO
fileId, or just forISystemMountPointor just forCollectiveMountPoint$fileIdthrough encryption storage wrapper or whether it's acceptable to use$this->rootView->getFileInfo()inUtil.php.Checklist
3. to review, feature component)stable32)AI (if applicable)