Skip to content

Cache of clear- to chiphertextDirectory mapping contains invalid entries #252

@infeo

Description

@infeo

To map (virtual) cleartext paths to actual ciphertext paths on the filesystem (e.g. /foo/bar -> /d/00/92jALKJSPPOI...) the class CryptoPathMapper is used.

Inside the class a cache is used for frequent clear->cipher mappings to prevent expensive IO operations. If a path is deleted or moved, the cache must be cleared of such a mapping and of all child mappings.

In the current implemenation this is not the case:

public void invalidatePathMapping(CryptoPath cleartextPath) {
ciphertextDirectories.asMap().remove(cleartextPath);
}
public void movePathMapping(CryptoPath cleartextSrc, CryptoPath cleartextDst) {
var cachedValue = ciphertextDirectories.asMap().remove(cleartextSrc);
if (cachedValue != null) {
ciphertextDirectories.put(cleartextDst, cachedValue);
}
}

Only the mapping of the deleted/moved cleartext directory itself is removed, but no children. Hence, the cache contains invalid entries, leading to unexpected errors.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions