From a7e13685679b26c4572b8893f8c8128c228a97e5 Mon Sep 17 00:00:00 2001 From: Johnny Almonte Date: Tue, 13 Apr 2021 21:52:27 -0400 Subject: [PATCH] feat: clear sensitive data on sign out --- app/javascripts/main/window.ts | 4 ++-- package.json | 1 + yarn.lock | 17 ++++++----------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/javascripts/main/window.ts b/app/javascripts/main/window.ts index 7e02c11d..e0e7da19 100644 --- a/app/javascripts/main/window.ts +++ b/app/javascripts/main/window.ts @@ -18,6 +18,7 @@ import { checkForUpdate, setupUpdates } from './updateManager'; import { isTesting, lowercaseDriveLetter } from './utils'; import { initializeZoomManager } from './zoomManager'; import { Paths } from './paths'; +import { clearSensitiveDirectories } from 'electron-clear-data'; const WINDOW_DEFAULT_WIDTH = 1100; const WINDOW_DEFAULT_HEIGHT = 800; @@ -94,8 +95,7 @@ export async function createWindowState({ window.webContents.on('ipc-message', async (_event, message) => { if (message === IpcMessages.SigningOut) { - await window.webContents.session.clearStorageData(); - window.webContents.session.flushStorageData(); + clearSensitiveDirectories(); } }); diff --git a/package.json b/package.json index f453f2f8..8828158d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "dotenv": "^8.2.0", "electron": "^9.4.0", "electron-builder": "^22.9.1", + "electron-clear-data": "^1.0.3", "electron-notarize": "^1.0.0", "eslint": "^7.20.0", "eslint-config-prettier": "^6.11.0", diff --git a/yarn.lock b/yarn.lock index b8ed96b6..35b2118b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2507,6 +2507,11 @@ electron-builder@^22.9.1: update-notifier "^4.1.1" yargs "^16.0.3" +electron-clear-data@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/electron-clear-data/-/electron-clear-data-1.0.3.tgz#589b1b3daa9e77dbd321b5ba17b53cc6a86e5033" + integrity sha512-QSownRD/JOqN7c4ypD0+dEtz44hwNqCrsepqcyTciA8w4DJ6fk81JoFOdJbqngOHS/wqXpgXJU09J60s37138A== + electron-log@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-4.3.1.tgz#1405fef9d4e6964a5fdb8790a69163aa237ffe91" @@ -3081,7 +3086,7 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.0.1: +fs-extra@^9.0.1, fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== @@ -3091,16 +3096,6 @@ fs-extra@^9.0.1: jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" - integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== - dependencies: - at-least-node "^1.0.0" - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz"