Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

MXKAccountManager: accounts are stored in a discardable cache files when no app group id is available #509

Open
giomfo opened this issue Jan 9, 2019 · 1 comment
Labels

Comments

@giomfo
Copy link
Member

giomfo commented Jan 9, 2019

When no application group identifier is defined, the Matrix account credentials are stored in a discardable cache files (Library/Caches).

Indeed the [MXKAppSettings cacheFolder] used in MXKAccountManager:

NSString *matrixKitCacheFolder = [MXKAppSettings cacheFolder];
returns this folder when no group id is defined, see:
NSArray *cacheDirList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);

A new method should be added to MXKAppSettings to return an applicationSupportFolder (based on NSApplicationSupportDirectory), then the MXKAccountManager will be able to use it to store account data (when no group id is defined).

@tladesignz
Copy link

We experienced this, too.

See here, why that is a bad idea:

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
(Under "Where You Should Put Your App’s Files")

It seems, on storage constrained devices, this can happen fairly regularly.
My guess is, esp. when the App Store app loads updates and needs to keep these somewhere until they're complete.

It obviously copies this behavior from MatrixSDK:
https://github.com/matrix-org/matrix-ios-sdk/blob/develop/MatrixSDK/Data/Store/MXFileStore/MXFileStore.m#L802

I'd recommend cross-checking in MatrixSDK, if the encryption keys are lost, when the cache is purged. That's also not nice...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants