Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,26 @@ public final class ProductPackagingToolSpec : GenericCommandLineToolSpec, SpecId
// This is only supported when App Sandbox or Hardened Runtime is enabled.
for (buildSetting, entitlementPrefix) in Self.sandboxFileAccessSettingsAndEntitlements {
let fileAccessValue = cbc.scope.evaluate(buildSetting)
let correspondingEntitlementKey: String?

switch fileAccessValue {
case .readOnly:
entitlementsDictionary["\(entitlementPrefix).read-only"] = .plBool(true)
correspondingEntitlementKey = "\(entitlementPrefix).read-only"
case .readWrite:
entitlementsDictionary["\(entitlementPrefix).read-write"] = .plBool(true)
correspondingEntitlementKey = "\(entitlementPrefix).read-write"
case .none:
break
correspondingEntitlementKey = nil
}

// The entitlements file is the ultimate authority, so if this is already configured there the build system should respect that.
if let correspondingEntitlementKey, entitlementsDictionary[correspondingEntitlementKey] == nil {
entitlementsDictionary[correspondingEntitlementKey] = .plBool(true)
}
}

for (buildSetting, entitlement) in Self.sandboxAndHardenedRuntimeBooleanEntitlements {
if cbc.scope.evaluate(buildSetting) {
// The entitlements file is the ultimate authority, so if this is already configured there the build system should respect that.
if cbc.scope.evaluate(buildSetting) && entitlementsDictionary[entitlement] == nil {
entitlementsDictionary[entitlement] = .plBool(true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ fileprivate struct EntitlementsBuildOperationTests: CoreBasedTests {
"com.apple.security.cs.debugger": "1",
"com.apple.security.cs.disable-executable-page-protection": "1",
"com.apple.security.cs.disable-library-validation": "1",
"com.apple.security.device.audio-input": "1",
"com.apple.security.device.audio-input": "0",
"com.apple.security.device.bluetooth": "1",
"com.apple.security.personal-information.calendars": "1",
"com.apple.security.device.camera": "1",
Expand All @@ -398,7 +398,7 @@ fileprivate struct EntitlementsBuildOperationTests: CoreBasedTests {
"com.apple.security.files.downloads.read-write": "1",
"com.apple.security.assets.pictures.read-only": "1",
"com.apple.security.assets.music.read-write": "1",
"com.apple.security.assets.movies.read-only": "1",
"com.apple.security.assets.movies.read-only": "0",
"com.apple.security.network.client": "1",
"com.apple.security.network.server": "1",
],
Expand Down
Loading