From 4c6566f42f793da029d7c95763d6b06363e5a55b Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 16 Dec 2019 13:20:56 -0800 Subject: [PATCH] stopped apps should not be updated or auto-updated --- CHANGES | 1 + src/apps.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 570579114..b78d365a0 100644 --- a/CHANGES +++ b/CHANGES @@ -1752,4 +1752,5 @@ [4.4.2] * Fix crash when reporting that DKIM is not setup correctly +* Stopped apps cannot be updated or auto-updated diff --git a/src/apps.js b/src/apps.js index 1b4a90b42..740b07d81 100644 --- a/src/apps.js +++ b/src/apps.js @@ -1229,6 +1229,8 @@ function update(appId, data, auditSource, callback) { error = checkAppState(app, exports.ISTATE_PENDING_UPDATE); if (error) return callback(error); + if (app.runState === exports.RSTATE_STOPPED) return callback(new BoxError(BoxError.BAD_STATE, 'Stopped apps cannot be updated')); + downloadManifest(data.appStoreId, data.manifest, function (error, appStoreId, manifest) { if (error) return callback(error); @@ -1749,6 +1751,8 @@ function canAutoupdateApp(app, newManifest) { if (!app.enableAutomaticUpdate) return false; if ((semver.major(app.manifest.version) !== 0) && (semver.major(app.manifest.version) !== semver.major(newManifest.version))) return false; // major changes are blocking + if (app.runState === exports.RSTATE_STOPPED) return false; // stopped apps won't run migration scripts and shouldn't be updated + const newTcpPorts = newManifest.tcpPorts || { }; const newUdpPorts = newManifest.udpPorts || { }; const portBindings = app.portBindings; // this is never null