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

Add loginhelper entitlement option #5023

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/app-builder-lib/electron-osx-sign/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface SignOptions extends BaseSignOptions {
binaries?: string[];
entitlements?: string;
'entitlements-inherit'?: string;
'entitlements-loginhelper'?: string;
'gatekeeper-assess'?: boolean;
hardenedRuntime?: boolean;
'identity-validation'?: boolean;
Expand Down
13 changes: 12 additions & 1 deletion packages/app-builder-lib/electron-osx-sign/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ function signApplicationAsync (opts) {
continue
}
debuglog('Signing... ' + filePath)
await execFileAsync('codesign', args.concat('--entitlements', opts['entitlements-inherit'], filePath))
let entitlementsFile = opts['entitlements-inherit']
if (filePath.includes('Library/LoginItems')) {
entitlementsFile = opts['entitlements-loginhelper']
}

await execFileAsync('codesign', args.concat('--entitlements', entitlementsFile, filePath))
}
debuglog('Signing... ' + opts.app)
await execFileAsync('codesign', args.concat('--entitlements', opts.entitlements, opts.app))
Expand Down Expand Up @@ -335,6 +340,12 @@ const signAsync = module.exports.signAsync = function (opts) {
}
}
}
if (!opts['entitlements-loginhelper']) {
filePath = opts.entitlements
debugwarn('No `entitlements-loginhelper` passed in arguments:', '\n',
'* Sandbox entitlements file for login helper is default to:', filePath)
opts['entitlements-loginhelper'] = filePath
}
})
.then(async function () {
// Pre-sign operations
Expand Down
16 changes: 15 additions & 1 deletion packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,13 @@
"string"
]
},
"entitlementsLoginHelper": {
"desciption": "Path to login helper entitlement file. When using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inheritted entitlements cannot be inherited since the login helper is a standalone executable. Defaults to the value provided for `entitlements`.\n\nThis option only applies when signing with `entitlements` provided.",
"type": [
"null",
"string"
]
},
"extendInfo": {
"description": "The extra entries for `Info.plist`."
},
Expand Down Expand Up @@ -2522,6 +2529,13 @@
"string"
]
},
"entitlementsLoginHelper": {
"desciption": "Path to login helper entitlement file. When using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inheritted entitlements cannot be inherited since the login helper is a standalone executable. Defaults to the value provided for `entitlements`.\n\nThis option only applies when signing with `entitlements` provided.",
"type": [
"null",
"string"
]
},
"extendInfo": {
"description": "The extra entries for `Info.plist`."
},
Expand Down Expand Up @@ -6084,4 +6098,4 @@
}
},
"type": "object"
}
}
1 change: 1 addition & 0 deletions packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
if (customSignOptions.provisioningProfile != null) {
signOptions["provisioning-profile"] = customSignOptions.provisioningProfile
}
signOptions['entitlements-loginhelper'] = customSignOptions.entitlementsLoginHelper
}

//noinspection JSMethodCanBeStatic
Expand Down
2 changes: 2 additions & 0 deletions packages/app-builder-lib/src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
*/
readonly entitlementsInherit?: string | null

readonly entitlementsLoginHelper?: string | null

/**
* The path to the provisioning profile to use when signing, absolute or relative to the app root.
*/
Expand Down