Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging - OSX: GateKeeper shows 'can't be opened because Apple cannot check it for malicious software' #510

Closed
2 tasks done
bryphe opened this issue Jul 31, 2019 · 7 comments
Labels
bug Something isn't working I-daily-editor-blocker An issue blocking use of the editor as a day-to-day editor

Comments

@bryphe
Copy link
Member

bryphe commented Jul 31, 2019

Issue: When downloading, and trying to run the Onivim2.dmg from our published builds, we get this GateKeeper warning:

image

WORKAROUND:

  • Right-click on the Onivim2.dmg and select Open With -> DiskImageMounter (default)

image

  • Install as usual (drag-and-drop Onivim2 -> Applications)
  • Run from Finder

Details:

Running the spctl tool with spctl --assess --verbose Onivim2.dmg shows:

spctl --assess --verbose Onivim2.dmg
Onivim2.dmg: rejected (the code is valid but does not seem to be an app)

It's not clear to me why we're getting this message - the process we follow is:

  • Run codesign --deep against the app package
  • Package DMG
  • Run codesign again on the DMG
  • Submit DMG for notarization
  • Get successful result back w/ no warnings from notarization

In the meantime, I did find several issues with our .App package that we need to address (none of these fixed that particular issue, but they might prevent future / other issues):

  • There are several resource files in the Onivim2.App/Contents/MacOS folder - an image, fonts, and others. We need to move these to the Onivim2.App/Contents/Resources folder.
  • There are several folders at the Contents folder that should be moved to Resources: camomile, textmate_service, extensions
  • The dynamic libs (dylibs) that we bundle need to be in the Onivim2.App/Contents/Frameworks folder

I trouble-shooted by packaging an absolute minimum app - with just a single executable - and still consistently received this failure when running spctl --assess --verbose.

However, I found that if I package as a .zip, it actually passes validation - and opening it still gives a prompt, but a workaround isn't needed, and it's less scary sounding:
image

Unfortunately, this will be a pretty significant / risky change - so I won't be able to get it in prior to the release. But I will work on this next so we can get rid of this.

Plan of action is:

  • Fix bundle issues listed above
  • Switch to distributing a .zip instead of a .dmg
@bryphe
Copy link
Member Author

bryphe commented Jul 31, 2019

It looks like the 'runtime hardening' is also problematic for node - it causes the node process we bundle to fail to execute.

In addition to above, we'll have to set up a proper set of entitlements for that process to enable application hardening - a related issue / discussion is here: electron/osx-sign#188

@bryphe bryphe added bug Something isn't working I-daily-editor-blocker An issue blocking use of the editor as a day-to-day editor labels Jul 31, 2019
@montogeek
Copy link

If you are in Catalina:

  1. Download tar.gz
  2. Decompress it.
  3. Move Onivim2.App.app to Applications.
  4. Right click on it, click in Show Package Contents
  5. Open Contents > MacOS
  6. Double click in Oni2 executable.

This will run a bash (I think) script that would run the application.

@ronakg
Copy link

ronakg commented Jul 31, 2019

If you are in Catalina:

  1. Download tar.gz
  2. Decompress it.
  3. Move Onivim2.App.app to Applications.
  4. Right click on it, click in Show Package Contents
  5. Open Contents > MacOS
  6. Double click in Oni2 executable.

This will run a bash (I think) script that would run the application.

This is not working for me. I get the same error when I click the Oni2 script to open it.

@TheSpyder
Copy link

TheSpyder commented Jul 31, 2019

Do you even need to sign the DMG? I thought most of those that I download are unsigned, it’s just the app inside that counts, and what I thought needed to be notarised.

The “app downloaded from the internet” dialog is totally normal.

@bryphe
Copy link
Member Author

bryphe commented Jul 31, 2019

@TheSpyder - I actually tried both ways! I thought too maybe the signing of the DMG was causing an issue, but if you try to upload the DMG to be notarized, it has to be signed (or else the upload will fail) - and the contents have to be signed of course.

@gitbugr
Copy link

gitbugr commented Jul 31, 2019

.tar.gz didn't work for me. However after dragging the .app to my Applications folder, running this in the terminal works for now:

/Applications/Onivim2.App/Contents/MacOS/Oni2

@TheSpyder
Copy link

TheSpyder commented Jul 31, 2019

@bryphe what if you only upload the app for notarization, not the dmg? Or am I totally misunderstanding the notarization process? Here's an example (electron app) I downloaded just yesterday:
https://github.com/Automattic/simplenote-electron/releases/tag/v1.6.0

$ spctl --assess --verbose Simplenote-macOS-1.6.0.dmg 
Simplenote-macOS-1.6.0.dmg: rejected
source=no usable signature
$ spctl --assess --verbose /Volumes/Simplenote\ Installer/Simplenote.app
/Volumes/Simplenote Installer/Simplenote.app: accepted

And the DMG opens without issue. The app doesn't, but I don't think automattic code sign their builds at all.

Although, the oni v1 DMG has the same spctl result but it opens fine:

$ spctl --assess --verbose Oni-0.3.9-osx.dmg
Oni-0.3.9-osx.dmg: rejected (the code is valid but does not seem to be an app)

But I guess that could just be because existing apps are not forced to be notiarized until Catalina.

bryphe added a commit that referenced this issue Aug 1, 2019
…sources (#530)

* Update the packaged setup to point to 'Resources'

* Move extensions/textmate_service/camomile to Resources folder

* Formatting
bryphe added a commit that referenced this issue Aug 1, 2019
* Move dyllibs to 'Frameworks' directory per MacOS bundle guidelines

* Set inner installation path of libraries

* No longer need to special case the dylibs; since they are in the expected bundle location
@bryphe bryphe closed this as completed in 72ea674 Aug 1, 2019
bryphe added a commit that referenced this issue Aug 1, 2019
* Fix up macos directory layout, use symlinks

* Use symlinks for resource files

* Add healthcheck to verify font is present

* Fix healthcheck

* Fix HealthCheck

* Fix formatting, add additional logging for health checks

* Fix bug with hanging setup.json symlink
bryphe added a commit that referenced this issue Aug 2, 2019
* Fix up signing / notarization scripts

* Update codesign.sh

* Package tar as well

* Distribute tar and dmg

* publish -> package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working I-daily-editor-blocker An issue blocking use of the editor as a day-to-day editor
Projects
None yet
Development

No branches or pull requests

5 participants