Skip to content

Add support for enable/disable-get-task-allow-entitlement with swiftbuild build system #8378

Open
@cmcgee1024

Description

@cmcgee1024

The test case BuildCommandSwiftBuildTests.testGetTaskAllowEntitlement is currently skipped because the test doesn't work with the swiftbuild build system. The test is in place to verify that a specific entitlement com.apple.security.get-task-allow is codesigned into an executable or not based on factors, such as the build configuration (release or debug), and also certain hidden flags --enable/disable-get-task-allow-entitlement that override the configuration. The entitlement itself, like all entitlements, is macOS specific and it grants extra debugging capabilities with the executable. https://developer.apple.com/documentation/security/resolving-common-notarization-issues#Avoid-the-get-task-allow-entitlement

This test case needs to be adjusted to not rely so heavily on parsing the build output. Instead, it should verify the executables after each build to see if the entitlement is present, or not. It can use something like the following command and check the output for the get-task-allow entitlement:

codesign -d --entitlements - <path_to_executable>
--
[Dict]
        [Key] com.apple.security.get-task-allow
        [Value]
                [Bool] true

Also, the SwiftBuildSupport will need to pass along the command-line option override, if present to swift-build as a build setting: ENTITLEMENTS_DONT_REMOVE_GET_TASK_ALLOW for the test to succeed in some of the cases.

On non-macOS systems, the test case checks for a warning message to be emitted indicating that entitlements are not available on the platform, and they are essentially ignored. Those checks should remain in place since the warning message should be emitted when using the swiftbuild build system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    swift buildChanges impacting `swift build`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions