From 103e5e0ab87d7b42453dbe434b3f9fda542f9b12 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Wed, 23 Oct 2019 08:41:18 +1100 Subject: [PATCH 1/3] Added mac signing --- build/entitlements.mac.plist | 9 +++++++++ build/entitlements.mas.plist | 1 + build/notarize.js | 28 ++++++++++++++++++++++++++++ package.json | 17 ++++++++--------- 4 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 build/entitlements.mac.plist create mode 100644 build/notarize.js diff --git a/build/entitlements.mac.plist b/build/entitlements.mac.plist new file mode 100644 index 000000000..01d053be3 --- /dev/null +++ b/build/entitlements.mac.plist @@ -0,0 +1,9 @@ + + + + + + com.apple.security.cs.allow-unsigned-executable-memory + + + diff --git a/build/entitlements.mas.plist b/build/entitlements.mas.plist index 5bfb52be4..cc799ebf9 100644 --- a/build/entitlements.mas.plist +++ b/build/entitlements.mas.plist @@ -2,6 +2,7 @@ + com.apple.security.app-sandbox com.apple.security.network.client diff --git a/build/notarize.js b/build/notarize.js new file mode 100644 index 000000000..ca2ae95d3 --- /dev/null +++ b/build/notarize.js @@ -0,0 +1,28 @@ +const { notarize } = require("electron-notarize") + +/* + Pre-requisites: https://github.com/electron/electron-notarize#prerequisites + 1. Generate an app specific password + 2. Export SIGNING_APPLE_ID, SIGNING_APP_PASSWORD, SIGNING_TEAM_ID environment variables +*/ + +/* + Notarizing: https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/ +*/ + +exports.default = async function notarizing (context) { + const { electronPlatformName, appOutDir } = context + if (electronPlatformName !== "darwin") { + return + } + + const appName = context.packager.appInfo.productFilename + + return notarize({ + appBundleId: "com.loki-project.messenger-desktop", + appPath: `${appOutDir}/${appName}.app`, + appleId: process.env.SIGNING_APPLE_ID, + appleIdPassword: process.env.SIGNING_APP_PASSWORD, + ascProvider: process.env.SIGNING_TEAM_ID + }) +} diff --git a/package.json b/package.json index 4bc7aa434..03f2bea36 100644 --- a/package.json +++ b/package.json @@ -193,21 +193,20 @@ "node": "10.13.0" }, "build": { - "appId": "org.loki.messenger-desktop", + "appId": "com.loki-project.messenger-desktop", + "afterSign": "build/notarize.js", "mac": { "artifactName": "${name}-mac-${version}.${ext}", "category": "public.app-category.social-networking", "icon": "build/icons/mac/icon.icns", - "publish": [ - { - "provider": "generic", - "url": "https://updates.signal.org/desktop" - } - ], "target": [ - "zip" + "7z" ], - "bundleVersion": "1" + "bundleVersion": "1", + "hardenedRuntime": true, + "gatekeeperAssess": false, + "entitlements": "build/entitlements.mac.plist", + "entitlementsInherit": "build/entitlements.mac.plist" }, "win": { "asarUnpack": "node_modules/spellchecker/vendor/hunspell_dictionaries", From 1250d93252cae465265db34246d4ce93b122b884 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Wed, 23 Oct 2019 09:24:56 +1100 Subject: [PATCH 2/3] Added electron-notarize --- package.json | 1 + yarn.lock | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/package.json b/package.json index 03f2bea36..7d65e7623 100644 --- a/package.json +++ b/package.json @@ -157,6 +157,7 @@ "electron": "4.1.2", "electron-builder": "20.39.0", "electron-icon-maker": "0.0.3", + "electron-notarize": "^0.1.1", "eslint": "4.14.0", "eslint-config-airbnb-base": "12.1.0", "eslint-config-prettier": "2.9.0", diff --git a/yarn.lock b/yarn.lock index f81384a2c..ad348a8a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2766,6 +2766,14 @@ electron-is-dev@^1.0.1: resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-1.0.1.tgz#6e0a184736fe7aea77d18210b0b0f6a02402c4bc" integrity sha512-iwM3EotA9HTXqMGpQRkR/kT8OZqBbdfHTnlwcxsjSLYqY8svvsq0MuujsWCn3/vtgRmDv/PC/gKUUpoZvi5C1w== +electron-notarize@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/electron-notarize/-/electron-notarize-0.1.1.tgz#c3563d70c5e7b3315f44e8495b30050a8c408b91" + integrity sha512-TpKfJcz4LXl5jiGvZTs5fbEx+wUFXV5u8voeG5WCHWfY/cdgdD8lDZIZRqLVOtR3VO+drgJ9aiSHIO9TYn/fKg== + dependencies: + debug "^4.1.1" + fs-extra "^8.0.1" + electron-osx-sign@0.4.11: version "0.4.11" resolved "https://registry.yarnpkg.com/electron-osx-sign/-/electron-osx-sign-0.4.11.tgz#8377732fe7b207969f264b67582ee47029ce092f" @@ -3677,6 +3685,15 @@ fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^8.0.1: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-minipass@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" @@ -4033,6 +4050,11 @@ graceful-fs@^4.1.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +graceful-fs@^4.2.0: + version "4.2.2" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" + integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== + "graceful-readlink@>= 1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" From 3ba71fad9e0728444666fba3c8110c3ac53daddc Mon Sep 17 00:00:00 2001 From: Mikunj Date: Wed, 23 Oct 2019 09:31:36 +1100 Subject: [PATCH 3/3] Linting. --- _locales/en/messages.json | 3 +-- build/notarize.js | 30 +++++++++++++++--------------- js/background.js | 1 - 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 0630a41c6..81a15ee2c 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1234,8 +1234,7 @@ "Additional detail provided for Link Previews option in settings screen" }, "linkPreviewsSettingDescription": { - "message": - "Enable local link previews", + "message": "Enable local link previews", "description": "Description shown for the Link Preview option " }, "spellCheckDescription": { diff --git a/build/notarize.js b/build/notarize.js index ca2ae95d3..ac5a2c138 100644 --- a/build/notarize.js +++ b/build/notarize.js @@ -1,4 +1,4 @@ -const { notarize } = require("electron-notarize") +const { notarize } = require('electron-notarize'); /* Pre-requisites: https://github.com/electron/electron-notarize#prerequisites @@ -10,19 +10,19 @@ const { notarize } = require("electron-notarize") Notarizing: https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/ */ -exports.default = async function notarizing (context) { - const { electronPlatformName, appOutDir } = context - if (electronPlatformName !== "darwin") { - return - } +exports.default = async function notarizing(context) { + const { electronPlatformName, appOutDir } = context; + if (electronPlatformName !== 'darwin') { + return; + } - const appName = context.packager.appInfo.productFilename + const appName = context.packager.appInfo.productFilename; - return notarize({ - appBundleId: "com.loki-project.messenger-desktop", - appPath: `${appOutDir}/${appName}.app`, - appleId: process.env.SIGNING_APPLE_ID, - appleIdPassword: process.env.SIGNING_APP_PASSWORD, - ascProvider: process.env.SIGNING_TEAM_ID - }) -} + return notarize({ + appBundleId: 'com.loki-project.messenger-desktop', + appPath: `${appOutDir}/${appName}.app`, + appleId: process.env.SIGNING_APPLE_ID, + appleIdPassword: process.env.SIGNING_APP_PASSWORD, + ascProvider: process.env.SIGNING_TEAM_ID, + }); +}; diff --git a/js/background.js b/js/background.js index 2ce0b821d..0c691883d 100644 --- a/js/background.js +++ b/js/background.js @@ -612,7 +612,6 @@ storage.put('linkPreviews', true); }); - // listeners Whisper.RotateSignedPreKeyListener.init(Whisper.events, newVersion); // window.Signal.RefreshSenderCertificate.initialize({