"xcodebuild -allowProvisioningUpdates" fails to generate provisioning profiles when running in an ssh session

Number:rdar://49383188 Date Originated:March 28 2019
Status:Duplicate of 40339867 - Open Resolved:
Product:Xcode Product Version:10.2 build 10E125
Classification:Bug Reproducible:Always
When xcodebuild runs with the -allowProvisioningUpdates option from an ssh session, the authentication process fails, resulting in a build failure as provisioning profiles cannot be generated. There is no such issue when running the same command on the Terminal app from a GUI session.

Steps to Reproduce:
1. Verify the build process works by issuing the following commands in a terminal:
    rm -R ~/Library/MobileDevice/Provisioning\ Profiles  # delete the cache of provisioning profiles
    security unlock-keychain ~/Library/Keychains/login.keychain-db  # open the login keychain
    xcodebuild archive -archivePath mybuild.xcarchive -project myproject.xcodeproj -scheme "MyTarget - Release" -allowProvisioningUpdates

2. Log into localhost using ssh
    ssh localhost

3. Issue the commands from step 1. During the startup phase of the build, the authentication process fails with error 1100.

Expected Results:
xcodebuild properly logs into the developer account, generates a provisioning profile and completes the build.

Actual Results:
xcodebuild displays the following error:

2019-03-28 15:24:25.965 xcodebuild[5652:96269]  DVTPortal: Service '<DVTPortalViewDeveloperService: 0x7f8c5d451f30; action='viewDeveloper'>' encountered an unexpected result code from the portal ('1100')
2019-03-28 15:24:25.965 xcodebuild[5652:96269]  DVTPortal: Error:
Error Domain=DVTPortalServiceErrorDomain Code=1100 "Your session has expired.  Please log in." UserInfo={payload=<CFBasicHash 0x7f8c6de8a160 [0x7fffa97678f0]>{type = mutable dict, count = 9,
entries =>
        0 : responseId = <CFString 0x7f8c6de8a340 [0x7fffa97678f0]>{contents = "14f78f6b-90c5-4886-ad89-ff381e5ed6c3"}
        2 : <CFString 0x7fffa97c7c58 [0x7fffa97678f0]>{contents = "protocolVersion"} = QH65B2
        3 : <CFString 0x7f8c6de8cbd0 [0x7fffa97678f0]>{contents = "requestUrl"} = <CFString 0x7f8c75b77510 [0x7fffa97678f0]>{contents = "https://developerservices2.apple.com/services/QH65B2/viewDeveloper.action"}
        6 : <CFString 0x7f8c75b5a4e0 [0x7fffa97678f0]>{contents = "userLocale"} = en_US
        8 : resultCode = <CFNumber 0xf47837e5d54ae1fb [0x7fffa97678f0]>{value = +1100, type = kCFNumberSInt64Type}
        9 : userString = <CFString 0x7f8c6de8a200 [0x7fffa97678f0]>{contents = "Your session has expired.  Please log in."}
        10 : <CFString 0x7f8c75b5e120 [0x7fffa97678f0]>{contents = "resultString"} = <CFString 0x7f8c6deae2a0 [0x7fffa97678f0]>{contents = "authentication.failed"}
        11 : httpCode = <CFNumber 0xf47837e5d54e65fb [0x7fffa97678f0]>{value = +200, type = kCFNumberSInt64Type}
        12 : <CFString 0x7f8c7610d340 [0x7fffa97678f0]>{contents = "creationTimestamp"} = <CFString 0x7f8c6deb08c0 [0x7fffa97678f0]>{contents = "2019-03-28T15:24:25Z"}
, NSLocalizedDescription=Your session has expired.  Please log in.}

Xcode 10.2 build 10E125



Seeing this in Xcode 11.1, macOS 10.14.6 though. I don't know if upgrading to Catalina would help though… Also don't think our CI is using SSH at all.

Xcode 11 doesn't suffer from this issue (tested on macOS 10.15). Apple has not closed the radar.

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!