Jump to content
Developer Wiki and Function Reference Links ×

macOS notarization and VW plug-in development


Hans Martin Kern

Recommended Posts

I found that Vectorworks 2020 uses the the "disable-library-validation" entitlement, so plug-ins should load and run (for now). However, it looks like it is lacking the "get-task-allow" entitlement, which enables debugging the plug-ins with Xcode debugger (at least on 10.14.6, lldb can no longer attach to the Vectorworks 2020 process). Any pointers?

Edited by Hans Martin Kern
Link to comment
  • 2 weeks later...
  • 1 month later...

So I'm getting that signing and notarizing *are not* required, but I will need to use `csrutil` if I want to debug?

 

I just had a weird situation where VW simply crashed on startup unless I used `codesign` on the binary at `MyLib.vwlibrary/Contents/MacOS/MyLib`. Once that's signed, then VW can proceed but my the debug messages I throw out at registration time aren't showing in console, and I can't see the tools in the Workspace Editor.

 

(Also noticed: the SDK manual still has stuff about .rsrc files in it ... maybe we could figure out a way to document this stuff).

 

macOS 10.15.2 beta, VW 2020 SP2 (513482)

Edited by Ryan McCuaig
Link to comment

🤦‍♂️ ... I had a build step that used `cp -LR` to copy the bundle into a plug-ins folder. I was using `-L` (resolve symlinks) because I didn't understand that `BuildVWR` will symlink when `VWR_MODE="Debug 64"`, which was leading to Xcode producing a bundle that didn't have all the resources, but instead an alias to the .vwr file. (This is the default behaviour in the tester module, if you're compiling debug builds). This `cp` step was breaking Xcode's code signing (ie. none of the string or png resources were present in `MyLib.vwlibrary/.vwlibrary/Contents/_CodeSignature/CodeResources`), so VW freaked out and crashed on startup, presuming malware.

 

(The clue was that manually copying either the tester module library, or my own library, into Plug-Ins made it work).

Edited by Ryan McCuaig
Link to comment
  • 2 months later...
On 10/17/2019 at 6:37 AM, JBenghiat said:

At the moment, the solution is to use csrutil to disable System Integrity Protection. I’m not sure if there is a longer term fix with adjusting entitlements.

 

Thanks, this helped me out on the developer side. But clients are now reporting Vectorworks prevents them of using the plug-in because of restrictions obviously...

Do we need to modify some settings of our projects for them to be accepted somehow?

Link to comment
24 minutes ago, Hippocode said:

 

Thanks, this helped me out on the developer side. But clients are now reporting Vectorworks prevents them of using the plug-in because of restrictions obviously...

Do we need to modify some settings of our projects for them to be accepted somehow?

 

How do you release your plugins?

 

For example downloading a ZIP per Safari and unpacking the plug-ins, that will lead to quarantined plug-ins.

Link to comment

All of them as zipped files (download available on a website or Google Drive). Some bundles support the third party plug-in installer within Vectorworks, which requires the files to be zipped.
I also zip them because some browsers/cloud solutions rename extensions and capital letters in the VWR resource on download/zip which breaks the plug-in.

 

I can't really imagine doing this without these files being zipped 😮

Edited by Hippocode
Link to comment
2 minutes ago, Hippocode said:

All of them as zipped files. Some bundles come as an installer with a script using the build in third party support of Vectorworks.
I also zip them because many programs/cloud solutions rename extensions and capital letters in the VWR resource which breaks the pug-in.

 

I can't really imagine doing this without these files being zipped 😮

 

Try to put all those in a DMG and sign the DMG (notarizing it is probably optional, but can be a good way to notarize all applications contained on it).

 

Probably you will need to sign and notarize the installers too.

Link to comment

I removed the quarantaine of the buildvwr tool instead of disabling scrutil so I can see the error messages myself.

Signing alone doesn't do it and I'm unable to create an archive of the plugin in order to get it notarised (Also tried it on the TesterModule sample). Has anyone done this before? I'll see if I can do it manually using terminal instead.

 

 

 

Edited by Hippocode
Link to comment

 

2 minutes ago, Hippocode said:

I removed the quarantaine of the buildvwr tool instead of disabling scrutil so I can see the error messages myself.

Signing alone doesn't do it and I'm unable to create an archive of the plugin in order to get it notarised (Also tried it on the TesterModule sample). Has anyone done this before? I'll see if I can do it manually using terminal instead.

 

Plug-Ins by themselves are not apps, so you cannot notarize them (as far as I understand).

 

If you do not or cannot use what @JBenghiat has meant above, you will have to make an installer in such a way that you can sign and notarize it.

Link to comment

The rule of thumb is: you need notarization if you use Apple tools that trigger GateKeeper.

 

As VW unzips the file by its own mean, not by Apple tools, Gatekeeper is not triggered and therefore the notarization is not needed.

(However, that is a reason (at least for C++-plugins) why VW must advertise that it loads extra code outside the app bundle.)

Link to comment
  • 4 weeks later...

Another related issue: After the upgrade to XCode 11 we keep getting build errors in seemingly random plug-ins that are caused by codesigning. The error message says it's about resource forks or finder info.

Some site in the Internet said 

 

>>According to Apple:
>>Note that browsing files within a bundle with Finder’s Show Package Contents command can cause Finder info to be added to those files. 

 

Obviously, we need to do such browsing very often, for instance when we edit .vwstrings or .vs files. 

 

So what can be done to make sure that this codesigning stuff doesn't interfere with the builds? Can we try switching codesigning off? Or try removing the resource forks &c automatically before each build? If we try that, we would need to assign write permissions to the files in the bundle which could interfere with Perforce.

 

Thanks for any help,

 

Stefan Bender

build errors.png

Link to comment
On 3/6/2020 at 1:53 PM, Stefan Bender said:

Obviously, we need to do such browsing very often, for instance when we edit .vwstrings or .vs files. 

 

I have been thinking during the weekend, why apparently we have no such problems (apart not signing our plugins).

 

I have realized that we use the BuildVWR script, even in Debug, as PostBuild-Step. That means an intermediary step between editing and the created plug-in, even inside a .vwr folder.

 

Alternatively, you could try using editors not creating resources, but that would probably mean you have to change your tools, so that is probably not a realistic option.

Link to comment
  • 6 months later...

A few addendums to this conversation.

 

Stefan's post above new seems to be crucial. This past week, without updating the OS or VW, plug-ins that were code signed suddenly stopped working with VW. This includes one of my plug-ins as well as the batch encryption library that comes in the current beta SDK. You can actually see plug-ins that will fail by showing package contents and looking for a code signing folder.

 

I also upgraded my system recently to a machine with a security chip. Note that setting options in the Startup Security Utility  https://support.apple.com/en-us/HT208198 do not affect System Integrity Protection, which still needs to happen from the command line. It took me a while to figure this out an get the debugger to attach to VW again.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...