#21: Add signature validation during installations

This commit is contained in:
Scott E. Graves
2019-05-28 13:50:36 -05:00
parent 51c30aefb6
commit dcafafaba9
2 changed files with 17 additions and 1 deletions

View File

@@ -706,6 +706,8 @@ ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => {
}); });
ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => { ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
let allowSkipVerification = false;
let tempSig; let tempSig;
let tempPub; let tempPub;
const cleanupFiles = () => { const cleanupFiles = () => {
@@ -723,6 +725,7 @@ ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
const errorHandler = err => { const errorHandler = err => {
cleanupFiles(); cleanupFiles();
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply, { standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply, {
AllowSkipVerification: allowSkipVerification,
Source: data.Source, Source: data.Source,
}, err); }, err);
}; };

View File

@@ -300,7 +300,7 @@ class App extends IPCContainer {
this.sendRequest(Constants.IPC_Install_Upgrade, { this.sendRequest(Constants.IPC_Install_Upgrade, {
Sha256: sha256, Sha256: sha256,
Signature: signature, Signature: signature,
SkipVerification: false, SkipVerification: !!data.SkipVerification,
Source: data.Destination, Source: data.Destination,
}); });
} else { } else {
@@ -507,6 +507,19 @@ class App extends IPCContainer {
DownloadActive: false, DownloadActive: false,
DownloadProgress: 0.0, DownloadProgress: 0.0,
DownloadName: '', 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);
}
}); });
}; };