Closed infeo closed 1 year ago
Currently, when FileSystemProvider.delete(Path p) is called for a file in cryptoFS, just the encrypted file is deleted: https://github.com/cryptomator/cryptofs/blob/b3755f354e4d57d47ab655cf43e8d83c41685c25/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemImpl.java#L415-L426
There is no cache invalidation for the path or openCryptoFiles. This can lead to reading deleted content:
@Test public void testCreateNewThenWriteThenDeleteThenRead() throws IOException { var bufToWrite = ByteBuffer.wrap("delete me".getBytes(StandardCharsets.UTF_8)); final int bytesRead; try (var ch = FileChannel.open(file, CREATE_NEW, WRITE)) { ch.write(bufToWrite); Files.delete(file); try (var ch2 = fileSystem.provider().newFileChannel(file, Set.of(CREATE, READ, WRITE))) { bytesRead = ch2.read(ByteBuffer.allocate(bufToWrite.capacity())); } } Assertions.assertEquals(-1, bytesRead); }
Currently, when FileSystemProvider.delete(Path p) is called for a file in cryptoFS, just the encrypted file is deleted: https://github.com/cryptomator/cryptofs/blob/b3755f354e4d57d47ab655cf43e8d83c41685c25/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemImpl.java#L415-L426
There is no cache invalidation for the path or openCryptoFiles. This can lead to reading deleted content: