From 9fbaf9a3ca313429c9fc0d29ae892306d89559ff Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Mon, 4 Jun 2018 14:56:47 +0200
Subject: [PATCH] fix: unpublishable / unpublishSafe

Corrected logic mistake and renamed unpublishable (internal) to canBeUnpublished to make it easier to follow logic.

Closes #2080
---
 lib/workers/branch/index.js                   |   2 +-
 lib/workers/branch/status-checks.js           |  26 +--
 .../repository/process/lookup/index.js        |   6 +-
 .../repository/process/lookup/rollback.js     |   2 +-
 test/workers/branch/index.spec.js             |   1 +
 test/workers/branch/status-checks.spec.js     |  18 +-
 .../lookup/__snapshots__/index.spec.js.snap   | 178 +++++++++---------
 website/docs/data-security.md                 |   2 +-
 8 files changed, 121 insertions(+), 114 deletions(-)

diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js
index 4de85f5b36..bf6d48cff9 100644
--- a/lib/workers/branch/index.js
+++ b/lib/workers/branch/index.js
@@ -118,7 +118,7 @@ async function processBranch(branchConfig, packageFiles) {
     if (
       config.type !== 'lockFileMaintenance' &&
       config.unpublishSafe &&
-      !config.unpublishable &&
+      config.canBeUnpublished &&
       (config.prCreation === 'not-pending' ||
         config.prCreation === 'status-success')
     ) {
diff --git a/lib/workers/branch/status-checks.js b/lib/workers/branch/status-checks.js
index 4b50921c6c..3ff65d02c3 100644
--- a/lib/workers/branch/status-checks.js
+++ b/lib/workers/branch/status-checks.js
@@ -6,30 +6,30 @@ async function setUnpublishable(config) {
   if (!config.unpublishSafe) {
     return;
   }
-  let unpublishable;
+  let canBeUnpublished;
   for (const upgrade of config.upgrades) {
-    if (typeof upgrade.unpublishable !== 'undefined') {
-      if (typeof unpublishable !== 'undefined') {
-        unpublishable = unpublishable && upgrade.unpublishable;
+    if (typeof upgrade.canBeUnpublished !== 'undefined') {
+      if (typeof canBeUnpublished !== 'undefined') {
+        canBeUnpublished = canBeUnpublished && upgrade.canBeUnpublished;
       } else {
-        ({ unpublishable } = upgrade);
+        ({ canBeUnpublished } = upgrade);
       }
     }
   }
-  if (typeof unpublishable === 'undefined') {
-    unpublishable = true;
+  if (typeof canBeUnpublished === 'undefined') {
+    canBeUnpublished = true;
   }
   const context = 'renovate/unpublish-safe';
   const existingState = await platform.getBranchStatusCheck(
     config.branchName,
     context
   );
-  if (config.unpublishSafe && typeof unpublishable !== 'undefined') {
-    // Set unpublishable status check
-    const state = unpublishable ? 'success' : 'pending';
-    const description = unpublishable
-      ? 'Packages are at least 24 hours old'
-      : 'Packages < 24 hours old can be unpublished';
+  if (config.unpublishSafe && typeof canBeUnpublished !== 'undefined') {
+    // Set canBeUnpublished status check
+    const state = canBeUnpublished ? 'pending' : 'success';
+    const description = canBeUnpublished
+      ? 'Packages < 24 hours old can be unpublished'
+      : 'Packages are at least 24 hours old';
     // Check if state needs setting
     if (existingState === state) {
       logger.debug('Status check is already up-to-date');
diff --git a/lib/workers/repository/process/lookup/index.js b/lib/workers/repository/process/lookup/index.js
index 3267151f02..a6cacd96d8 100644
--- a/lib/workers/repository/process/lookup/index.js
+++ b/lib/workers/repository/process/lookup/index.js
@@ -83,7 +83,7 @@ async function lookupUpdates(config) {
       isPin: true,
       newValue: fromVersion,
       newMajor: getMajor(fromVersion),
-      unpublishable: false,
+      canBeUnpublished: false,
     });
   }
   // Filter latest, unstable, etc
@@ -110,13 +110,13 @@ async function lookupUpdates(config) {
       update.isRange = true;
     }
 
-    // TODO: move unpublishable to npm-specific
+    // TODO: move canBeUnpublished to npm-specific
     const version = dependency.versions[toVersion];
     const elapsed =
       version && version.time
         ? moment().diff(moment(version.time), 'days')
         : 999;
-    update.unpublishable = elapsed === 0;
+    update.canBeUnpublished = elapsed === 0;
     // end TODO
 
     const bucket = getBucket(config, update);
diff --git a/lib/workers/repository/process/lookup/rollback.js b/lib/workers/repository/process/lookup/rollback.js
index 2da5e4729e..b300d699af 100644
--- a/lib/workers/repository/process/lookup/rollback.js
+++ b/lib/workers/repository/process/lookup/rollback.js
@@ -45,6 +45,6 @@ function getRollbackUpdate(config, versions) {
     newValue,
     newMajor: getMajor(toVersion),
     semanticCommitType: 'fix',
-    unpublishable: false,
+    canBeUnpublished: false,
   };
 }
diff --git a/test/workers/branch/index.spec.js b/test/workers/branch/index.spec.js
index cb2b176e0e..d296f028a2 100644
--- a/test/workers/branch/index.spec.js
+++ b/test/workers/branch/index.spec.js
@@ -56,6 +56,7 @@ describe('workers/branch', () => {
     it('skips branch if not unpublishSafe + pending', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(true);
       config.unpublishSafe = true;
+      config.canBeUnpublished = true;
       config.prCreation = 'not-pending';
       platform.branchExists.mockReturnValueOnce(true);
       const res = await branchWorker.processBranch(config);
diff --git a/test/workers/branch/status-checks.spec.js b/test/workers/branch/status-checks.spec.js
index 2cc53eda08..28c1d21432 100644
--- a/test/workers/branch/status-checks.spec.js
+++ b/test/workers/branch/status-checks.spec.js
@@ -19,23 +19,29 @@ describe('workers/branch/status-checks', () => {
       await setUnpublishable(config);
       expect(platform.getBranchStatusCheck.mock.calls.length).toBe(0);
     });
-    it('defaults to unpublishable', async () => {
+    it('defaults to canBeUnpublished', async () => {
       config.unpublishSafe = true;
       await setUnpublishable(config);
       expect(platform.getBranchStatusCheck.mock.calls.length).toBe(1);
       expect(platform.setBranchStatus.mock.calls.length).toBe(1);
     });
-    it('finds unpublishable false and sets status', async () => {
+    it('finds canBeUnpublished false and sets status', async () => {
       config.unpublishSafe = true;
-      config.upgrades = [{ unpublishable: true }, { unpublishable: false }];
+      config.upgrades = [
+        { canBeUnpublished: true },
+        { canBeUnpublished: false },
+      ];
       await setUnpublishable(config);
       expect(platform.getBranchStatusCheck.mock.calls.length).toBe(1);
       expect(platform.setBranchStatus.mock.calls.length).toBe(1);
     });
-    it('finds unpublishable false and skips status', async () => {
+    it('finds canBeUnpublished false and skips status', async () => {
       config.unpublishSafe = true;
-      config.upgrades = [{ unpublishable: true }, { unpublishable: false }];
-      platform.getBranchStatusCheck.mockReturnValueOnce('pending');
+      config.upgrades = [
+        { canBeUnpublished: false },
+        { canBeUnpublished: false },
+      ];
+      platform.getBranchStatusCheck.mockReturnValueOnce('success');
       await setUnpublishable(config);
       expect(platform.getBranchStatusCheck.mock.calls.length).toBe(1);
       expect(platform.setBranchStatus.mock.calls.length).toBe(0);
diff --git a/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap b/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap
index bb454bd4b9..2f679d7687 100644
--- a/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap
+++ b/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap
@@ -3,14 +3,15 @@
 exports[`manager/npm/lookup .lookupUpdates() disables major release separation (major) 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 1,
     "newMinor": 4,
@@ -18,7 +19,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -26,6 +26,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() disables major release separation (minor) 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -33,7 +34,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -41,14 +41,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() handles PEP440 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.9.4",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.4",
     "newMajor": 0,
     "newMinor": 9,
@@ -56,9 +57,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.4",
     "newMajor": 1,
     "newMinor": 4,
@@ -66,7 +67,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -83,6 +83,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() handles prerelease jumps 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.9.0-rc",
     "isRange": true,
     "newMajor": 2,
@@ -91,7 +92,6 @@ Array [
     "repositoryUrl": "https://github.com/Microsoft/TypeScript",
     "toVersion": "2.9.1-insiders.20180516",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -101,14 +101,15 @@ exports[`manager/npm/lookup .lookupUpdates() handles unknown purl 1`] = `Array [
 exports[`manager/npm/lookup .lookupUpdates() ignores pinning for ranges when other upgrade exists 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.9.7",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.7",
     "newMajor": 1,
     "newMinor": 4,
@@ -116,7 +117,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -124,11 +124,11 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() pins minor ranged versions 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.4.1",
     "type": "pin",
-    "unpublishable": false,
   },
 ]
 `;
@@ -144,6 +144,7 @@ exports[`manager/npm/lookup .lookupUpdates() rejects reverse ordered less than g
 exports[`manager/npm/lookup .lookupUpdates() replaces major complex ranged versions if configured 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.7.0",
     "isRange": true,
     "newMajor": 3,
@@ -152,7 +153,6 @@ Array [
     "repositoryUrl": "https://github.com/webpack/webpack",
     "toVersion": "3.8.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -160,6 +160,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() replaces minor complex ranged versions if configured 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -168,7 +169,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -176,6 +176,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() replaces non-range in-range updates 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -183,7 +184,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -191,14 +191,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns both updates if automerging minor 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 0,
     "newMinor": 9,
@@ -206,9 +207,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 1,
     "newMinor": 4,
@@ -216,7 +217,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -224,6 +224,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns minor update if automerging both patch and minor 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 0,
     "newMinor": 9,
@@ -231,9 +232,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -241,7 +242,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -249,6 +249,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns minor update if separate patches not configured 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 0,
     "newMinor": 9,
@@ -256,9 +257,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -266,7 +267,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -274,6 +274,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns only one update if automerging 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -281,7 +282,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -289,14 +289,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns only one update if automerging major 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 1,
     "newMinor": 4,
@@ -304,7 +305,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -312,14 +312,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns only one update if grouping 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 1,
     "newMinor": 4,
@@ -327,7 +328,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -335,6 +335,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns patch minor and major 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.8.0",
     "newMajor": 0,
     "newMinor": 8,
@@ -342,9 +343,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.8.12",
     "type": "patch",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.8.0",
     "newMajor": 0,
     "newMinor": 9,
@@ -352,9 +353,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.8.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -362,7 +363,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -370,6 +370,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns patch update if automerging patch 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 0,
     "newMinor": 9,
@@ -377,9 +378,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "patch",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -387,7 +388,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -395,6 +395,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() returns patch update if separateMinorPatch 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 0,
     "newMinor": 9,
@@ -402,9 +403,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "patch",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -412,7 +413,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -421,6 +421,7 @@ exports[`manager/npm/lookup .lookupUpdates() returns rollback for pinned version
 Array [
   Object {
     "branchName": "{{{branchPrefix}}}rollback-{{{depNameSanitized}}}-{{{newMajor}}}.x",
+    "canBeUnpublished": false,
     "commitMessageAction": "Roll back",
     "isRollback": true,
     "newMajor": 0,
@@ -428,9 +429,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "semanticCommitType": "fix",
     "type": "rollback",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.99",
     "newMajor": 1,
     "newMinor": 4,
@@ -438,7 +439,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -447,13 +447,13 @@ exports[`manager/npm/lookup .lookupUpdates() returns rollback for ranged version
 Array [
   Object {
     "branchName": "{{{branchPrefix}}}rollback-{{{depNameSanitized}}}-{{{newMajor}}}.x",
+    "canBeUnpublished": false,
     "commitMessageAction": "Roll back",
     "isRollback": true,
     "newMajor": 0,
     "newValue": "^0.9.7",
     "semanticCommitType": "fix",
     "type": "rollback",
-    "unpublishable": false,
   },
 ]
 `;
@@ -461,6 +461,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() should allow unstable versions if the current version is unstable 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.3.0-beta.1",
     "newMajor": 2,
     "newMinor": 5,
@@ -468,7 +469,6 @@ Array [
     "repositoryUrl": "https://github.com/vuejs/vue",
     "toVersion": "2.5.17-beta.0",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -476,6 +476,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() should allow unstable versions if the ignoreUnstable=false 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.5.16",
     "newMajor": 2,
     "newMinor": 5,
@@ -483,7 +484,6 @@ Array [
     "repositoryUrl": "https://github.com/vuejs/vue",
     "toVersion": "2.5.17-beta.0",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -491,19 +491,20 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() should downgrade from missing versions 1`] = `
 Object {
   "branchName": "{{{branchPrefix}}}rollback-{{{depNameSanitized}}}-{{{newMajor}}}.x",
+  "canBeUnpublished": false,
   "commitMessageAction": "Roll back",
   "isRollback": true,
   "newMajor": 1,
   "newValue": "1.16.0",
   "semanticCommitType": "fix",
   "type": "rollback",
-  "unpublishable": false,
 }
 `;
 
 exports[`manager/npm/lookup .lookupUpdates() should treat zero zero caret ranges as pinned 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.0.34",
     "isRange": true,
     "newMajor": 0,
@@ -512,7 +513,6 @@ Array [
     "repositoryUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped",
     "toVersion": "0.0.35",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -520,6 +520,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports > latest versions if configured 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.4.1",
     "newMajor": 2,
     "newMinor": 0,
@@ -527,7 +528,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "2.0.3",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -535,6 +535,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports complex major hyphen ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.7.0",
     "isRange": true,
     "newMajor": 3,
@@ -543,7 +544,6 @@ Array [
     "repositoryUrl": "https://github.com/webpack/webpack",
     "toVersion": "3.8.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -551,6 +551,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports complex major ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.7.0",
     "isRange": true,
     "newMajor": 3,
@@ -559,13 +560,13 @@ Array [
     "repositoryUrl": "https://github.com/webpack/webpack",
     "toVersion": "3.8.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
 
 exports[`manager/npm/lookup .lookupUpdates() supports complex ranges 1`] = `
 Object {
+  "canBeUnpublished": false,
   "fromVersion": "0.8.12",
   "isRange": true,
   "newMajor": 0,
@@ -574,13 +575,13 @@ Object {
   "repositoryUrl": "https://github.com/kriskowal/q",
   "toVersion": "0.9.7",
   "type": "minor",
-  "unpublishable": false,
 }
 `;
 
 exports[`manager/npm/lookup .lookupUpdates() supports complex tilde ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -589,7 +590,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -597,6 +597,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports in-range caret updates 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.0",
     "isRange": true,
     "newMajor": 1,
@@ -605,7 +606,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -613,6 +613,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports in-range gte updates 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.0",
     "isRange": true,
     "newMajor": 1,
@@ -621,7 +622,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -629,6 +629,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports in-range tilde updates 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.0",
     "isRange": true,
     "newMajor": 1,
@@ -637,7 +638,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -645,14 +645,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports minor and major upgrades for ranged versions 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 0,
     "newMinor": 9,
@@ -660,9 +661,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 1,
     "newMinor": 4,
@@ -670,7 +671,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -678,14 +678,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() supports minor and major upgrades for tilde ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 0,
     "newMinor": 9,
@@ -693,9 +694,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.4.4",
     "newMajor": 1,
     "newMinor": 4,
@@ -703,7 +704,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -711,6 +711,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades .x complex minor ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -719,7 +720,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -727,6 +727,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades .x major ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.7",
     "isRange": true,
     "newMajor": 1,
@@ -735,7 +736,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -743,14 +743,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades .x minor ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.3.0",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -758,7 +759,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -766,6 +766,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades .x minor ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -774,7 +775,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -782,6 +782,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades less than equal major ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.4.1",
     "isRange": true,
     "newMajor": 2,
@@ -790,7 +791,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "2.0.3",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -798,6 +798,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades less than equal minor ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -806,7 +807,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -814,6 +814,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades less than equal ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 0,
@@ -822,9 +823,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 1,
@@ -833,7 +834,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -841,6 +841,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades less than major ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.7",
     "isRange": true,
     "newMajor": 1,
@@ -849,7 +850,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -857,6 +857,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades less than ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.1",
     "isRange": true,
     "newMajor": 0,
@@ -865,9 +866,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.1",
     "isRange": true,
     "newMajor": 1,
@@ -876,7 +877,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -884,6 +884,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades major greater than less than ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.7",
     "isRange": true,
     "newMajor": 1,
@@ -892,7 +893,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -900,6 +900,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades major less than equal ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.0",
     "isRange": true,
     "newMajor": 1,
@@ -908,7 +909,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -916,6 +916,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades major less than ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.7",
     "isRange": true,
     "newMajor": 1,
@@ -924,7 +925,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -932,6 +932,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades minor greater than less than equals ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.8.0",
     "isRange": true,
     "newMajor": 0,
@@ -940,9 +941,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.8.0",
     "isRange": true,
     "newMajor": 1,
@@ -951,7 +952,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -959,6 +959,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades minor greater than less than ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 0,
@@ -967,9 +968,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 1,
@@ -978,7 +979,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -986,14 +986,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades minor ranged versions 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.0.1",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.1",
     "newMajor": 1,
     "newMinor": 4,
@@ -1001,7 +1002,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1009,6 +1009,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades multiple caret ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 0,
@@ -1017,9 +1018,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 1,
@@ -1028,7 +1029,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1036,6 +1036,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades multiple tilde ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 0,
@@ -1044,9 +1045,9 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "0.9.7",
     "type": "minor",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.7.2",
     "isRange": true,
     "newMajor": 1,
@@ -1055,7 +1056,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1063,6 +1063,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades shorthand major ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "0.9.7",
     "isRange": true,
     "newMajor": 1,
@@ -1071,7 +1072,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1079,6 +1079,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades shorthand minor ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -1087,7 +1088,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1095,14 +1095,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades tilde ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.3.0",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -1110,7 +1111,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1118,6 +1118,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() upgrades tilde ranges without pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -1126,7 +1127,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1134,14 +1134,15 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() uses the locked version for pinning 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.0.0",
     "repositoryUrl": "https://github.com/kriskowal/q",
     "type": "pin",
-    "unpublishable": false,
   },
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.0.0",
     "newMajor": 1,
     "newMinor": 4,
@@ -1149,7 +1150,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1157,6 +1157,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() widens .x OR ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.7.0",
     "isRange": true,
     "newMajor": 3,
@@ -1165,7 +1166,6 @@ Array [
     "repositoryUrl": "https://github.com/webpack/webpack",
     "toVersion": "3.8.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1173,6 +1173,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() widens major ranged versions if configured 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.7.0",
     "isRange": true,
     "newMajor": 3,
@@ -1181,7 +1182,6 @@ Array [
     "repositoryUrl": "https://github.com/webpack/webpack",
     "toVersion": "3.8.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1189,6 +1189,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() widens minor ranged versions if configured 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "1.3.0",
     "isRange": true,
     "newMajor": 1,
@@ -1197,7 +1198,6 @@ Array [
     "repositoryUrl": "https://github.com/kriskowal/q",
     "toVersion": "1.4.1",
     "type": "minor",
-    "unpublishable": false,
   },
 ]
 `;
@@ -1205,6 +1205,7 @@ Array [
 exports[`manager/npm/lookup .lookupUpdates() widens stanndalone major OR ranges 1`] = `
 Array [
   Object {
+    "canBeUnpublished": false,
     "fromVersion": "2.7.0",
     "isRange": true,
     "newMajor": 3,
@@ -1213,7 +1214,6 @@ Array [
     "repositoryUrl": "https://github.com/webpack/webpack",
     "toVersion": "3.8.1",
     "type": "major",
-    "unpublishable": false,
   },
 ]
 `;
diff --git a/website/docs/data-security.md b/website/docs/data-security.md
index 7078aa160d..58bcc7ca0f 100644
--- a/website/docs/data-security.md
+++ b/website/docs/data-security.md
@@ -48,7 +48,7 @@ This is necessary so that Renovate can learn enough about the repository to dete
 
 ##### **Write** access to commit statuses
 
-Renovate can utilise commit statuses for purposes such as to warn if a package in the current update is unpublishable. For example npm packages can be revoked within the first 24 hours of publication.
+Renovate can utilise commit statuses for purposes such as to warn if a package in the current update is canBeUnpublished. For example npm packages can be revoked within the first 24 hours of publication.
 
 ##### **Write** access to issues
 
-- 
GitLab