[epiphany] Add migrator to delete desktop thumbnail database



commit 97cad40584c926192dc680d7a18efd43914aec6b
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Jan 6 17:01:42 2018 -0600

    Add migrator to delete desktop thumbnail database
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778578

 lib/ephy-profile-utils.h                     |    2 +-
 src/profile-migrator/ephy-profile-migrator.c |   33 ++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 32dd8f3..710b204 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -24,7 +24,7 @@
 
 G_BEGIN_DECLS
 
-#define EPHY_PROFILE_MIGRATION_VERSION 25
+#define EPHY_PROFILE_MIGRATION_VERSION 26
 #define EPHY_INSECURE_PASSWORDS_MIGRATION_VERSION 11
 #define EPHY_SETTINGS_MIGRATION_VERSION 16
 #define EPHY_FIREFOX_SYNC_PASSWORDS_MIGRATION_VERSION 19
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index deb6cbf..8004d22 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1177,6 +1177,38 @@ out:
 }
 
 static void
+migrate_snapshot_thumbnails (void)
+{
+  /* We used to store snapshot service thumbnails in the global desktop
+   * thumbnail directory... which is not in any way namespaced to Epiphany.
+   * To avoid leaking old thumbnails on disk, revealing the user's browsing
+   * history, we have to delete all the thumbnails. That's fine because
+   * anything in the cache directory is fair game for deletion at any time.
+   *
+   * Note we don't have to delete thumbnails/normal because Epiphany does not
+   * create thumbnails of this size.
+   */
+  GError *error = NULL;
+  char *dir;
+
+  dir = g_build_filename (g_get_user_cache_dir (), "thumbnails", "large", NULL);
+  ephy_file_delete_dir_recursively (dir, &error);
+  if (error) {
+    g_warning ("Failed to delete %s: %s", dir, error->message);
+    g_error_free (error);
+  }
+  g_free (dir);
+
+  dir = g_build_filename (g_get_user_cache_dir (), "thumbnails", "fail", NULL);
+  ephy_file_delete_dir_recursively (dir, &error);
+  if (error) {
+    g_warning ("Failed to delete %s: %s", dir, error->message);
+    g_error_free (error);
+  }
+  g_free (dir);
+}
+
+static void
 migrate_nothing (void)
 {
   /* Used to replace migrators that have been removed. Only remove migrators
@@ -1215,6 +1247,7 @@ const EphyProfileMigrator migrators[] = {
   /* 23 */ migrate_sync_device_info,
   /* 24 */ migrate_bookmarks_timestamp,
   /* 25 */ migrate_passwords_timestamp,
+  /* 26 */ migrate_snapshot_thumbnails
 };
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]