From dcafafaba902e41feccdf9b5fcebef1c2db36194 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 28 May 2019 13:50:36 -0500 Subject: [PATCH] #21: Add signature validation during installations --- public/electron.js | 3 +++ src/App.js | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/public/electron.js b/public/electron.js index 22d0931..9ddeebf 100644 --- a/public/electron.js +++ b/public/electron.js @@ -706,6 +706,8 @@ ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => { }); ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => { + let allowSkipVerification = false; + let tempSig; let tempPub; const cleanupFiles = () => { @@ -723,6 +725,7 @@ ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => { const errorHandler = err => { cleanupFiles(); standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply, { + AllowSkipVerification: allowSkipVerification, Source: data.Source, }, err); }; diff --git a/src/App.js b/src/App.js index 6574b0b..9d1d435 100644 --- a/src/App.js +++ b/src/App.js @@ -300,7 +300,7 @@ class App extends IPCContainer { this.sendRequest(Constants.IPC_Install_Upgrade, { Sha256: sha256, Signature: signature, - SkipVerification: false, + SkipVerification: !!data.SkipVerification, Source: data.Destination, }); } else { @@ -507,6 +507,19 @@ class App extends IPCContainer { DownloadActive: false, DownloadProgress: 0.0, DownloadName: '', + }, () => { + if (!arg.data.Success) { + this.setErrorState(arg.data.Error, () => { + // TODO Prompt to verify + if (arg.data.AllowSkipVerification) { + this.installUpgrade( { + SkipVerification: true, + Source: arg.data.Source, + Success: true, + }); + } + }, false); + } }); };