dimanche 31 janvier 2016

Is there any way to delete the sqlite.wal while application crashes

One of our pen tester has raised the security concern. He wants us to remove the sqlite.wal when application crashes and when application goes to background. We have writen one function in appdelgate class which will remove the wal file.

Please find the code snippet below.

void uncaughtExceptionHandler(NSException *exception)
{
    id appdelegate = [[UIApplication sharedApplication] delegate];

    //Clear cache
    for(NSPersistentStore *store in [appdelegate persistentStoreCoordinator].persistentStores)
    {

        NSLog(@"\n\nUNCAUGHT EXCEPTION --- %@\n\n",[exception description]);
        NSError *error;
        NSURL *storeURL = store.URL;

        NSPersistentStoreCoordinator *storeCoordinator = [appdelegate persistentStoreCoordinator];
        [storeCoordinator removePersistentStore:store error:&error];
        [[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error];
    }

    [appdelegate setPersistentStoreCoordinator:nil];
    [appdelegate setManagedObjectContext:nil];
    NSManagedObjectModel *managedObjectModel = [appdelegate managedObjectModel];
    managedObjectModel = nil;
}

Our pen tester is using iExplorer tool to access sqlite.wal file. same tool I have installed in mac and tested. What I found was weird. same code is working fine in mac matchie. But in window still we can see the wal file.

Please suggest me to solve this issue. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire