finish_installation.app for bundle doesn't work in 10.8 since it's quarantined #230

Closed
yllan opened this Issue Nov 28, 2012 · 5 comments

Projects

None yet

4 participants

@yllan
yllan commented Nov 28, 2012

I use Sparkle to update a bundle inside iPhoto.app.

It works on 10.7 but fails on 10.8.
After some investigation, I found that it might be caused by the quarantined attribute.

11/28/12 1:46:08.000 PM kernel[0]: exec of /Users/me/Library/Containers/com.apple.iPhoto/Data/Library/Application Support/Hypo/finish_installation.app/Contents/MacOS/finish_installation denied since it was quarantined by iPhoto and created without user consent, qtn-flags was 0x00000006

Although there is releaseFromQuarantine: method in Sparkle's code, it did not lift the quarantine attribute successfully. errno=3.

Does that means we cannot update bundle in sandboxed 10.8 app?

@lid
lid commented Jan 22, 2013

+1 I get the same error, coincidentally also in iPhoto:

1/22/13 6:29:11.398 AM iPhoto[5558]: *** NSTask: Task create for path '/Users/me/Library/Containers/com.apple.iPhoto/Data/Library/Application Support/MyPlugin/finish_installation.app/Contents/MacOS/finish_installation' failed: 22, "Invalid argument".  Terminating temporary process.
1/22/13 6:29:11.000 AM kernel[0]: exec of /Users/me/Library/Containers/com.apple.iPhoto/Data/Library/Application Support/MyPlugin/finish_installation.app/Contents/MacOS/finish_installation denied since it was quarantined by iPhoto and created without user consent, qtn-flags was 0x00000006
@lid
lid commented Jan 22, 2013

Looks like this is a dupe of #163 & #165. Or maybe not, since no sandboxd denials are showing in the Console.

@lid
lid commented Jan 22, 2013

It looks like what's happening is iPhoto is setting a quarantine bit on the finish_installation executable.

$ xattr -p com.apple.quarantine "/Users/me/Library/Containers/com.apple.iPhoto/Data/Library/Application Support/MyPlugin/finish_installation.app/Contents/MacOS/finish_installation"
0006;50fe31ac;iPhoto;

I modified - (void)installWithToolAndRelaunch to try remove this quarantine bit before running that executable:

// Remove gatekeeper quarantine attribute on relaunchTool
    NSString *unquarantineCommand = [NSString stringWithFormat:@"xattr -dr com.apple.quarantine \"%@\"", relaunchToolPath];
    NSLog(@"unquarantineCommand: %@", unquarantineCommand);
    system([unquarantineCommand UTF8String]);

    if( useXPC )
        [SUXPC launchTaskWithLaunchPath: relaunchToolPath arguments:arguments];
    else
        [NSTask launchedTaskWithLaunchPath: relaunchToolPath arguments:arguments];

This seems to generate the correct log message:

1/22/13 10:29:00.368 AM iPhoto[22607]: unquarantineCommand: xattr -dr com.apple.quarantine "/Users/me/Library/Containers/com.apple.iPhoto/Data/Library/Application Support/MyPlugin/finish_installation.app/Contents/MacOS/finish_installation"

However, xattr still shows that the quarantine bit is set, and the same old error given by the OP is produced. Any thoughts on how remove the quarantine bit, or to otherwise work around the quarantine mechanism? (I did codesign everything, just in case, but to no avail.)

EDIT: I just saw the note about releaseFromQuarantine from the OP, but I don't see an error message related to this, and in any case it doesn't seem to be invoked for for finish_installation.

@karlvr
karlvr commented Aug 28, 2013

IT appears that releaseFromQuarantine is called for the finish_installation app, it is just failing with errno set to EPERM, indicating that permission was denied.

We are unable to use AuthorizationServices to allow the user to auth our ability to release from quarantine, as we're in a sandboxed app.

Perhaps Sparkle could detect this and simply present a link to download?

@pornel
Member
pornel commented Jan 9, 2016

That code has been refactored. Please reopen if it still happens.

@pornel pornel closed this Jan 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment