Skip to content

Design: ASC API key support for unattended real-device runner signing #4961

Done

Description

@strzhao

The failure class

On a macOS host with no interactive Xcode sign-in session, xcodebuild -allowProvisioningUpdates cannot resolve automatic provisioning for the real-device runner build. The build fails, and the CLI passes no credential source beyond that flag.

Today the working paths are:

  • sign in to Xcode once on that host, so a session persists for xcodebuild, or
  • set AGENT_DEVICE_IOS_SIGNING_IDENTITY and AGENT_DEVICE_IOS_PROVISIONING_PROFILE for manual signing, after fetching a profile by hand.

Where the gap is real

A host signed in to Xcode at least once keeps a working session, so this is not a blocker for a normal developer Mac. The gap is hard only where no interactive sign-in can happen or persist:

  • CI or headless device-farm Macs provisioned without an Apple ID session
  • unattended renewal after a profile expires or a device re-registers

Proposal

Extend the Apple runner setup env family (AGENT_DEVICE_IOS_TEAM_ID, AGENT_DEVICE_IOS_SIGNING_IDENTITY, AGENT_DEVICE_IOS_PROVISIONING_PROFILE) with an App Store Connect API key trio:

  • AGENT_DEVICE_IOS_AUTH_KEY_PATH
  • AGENT_DEVICE_IOS_AUTH_KEY_ID
  • AGENT_DEVICE_IOS_AUTH_KEY_ISSUER_ID

When a real-device build runs with -allowProvisioningUpdates and all three are set, pass -authenticationKeyPath, -authenticationKeyID, and -authenticationKeyIssuerID to xcodebuild. When any of the three is unset, keep today's behavior. This is build-time configuration like the rest of the family: no CLI flag and no command-surface change.

Document it with the family: a row in the configuration table's "Apple runner setup" entry, a bullet in the runner setup steps, and a typed failure reason (for example signing_auth_key_incomplete when the trio is partially set, instead of build_failed_unclassified).

Validation so far

Hand-tested locally on 2026-11-13: the trio unblocked a real-device runner build on a host with no Xcode sign-in, and automatic provisioning resolved without a GUI session. I keep a patch against the then-current runner-artifact.ts and can turn it into a PR if the direction looks right.

Activity

  1. added
    enhancement
    on Nov 23, 2026
  2. thymikee commented on Nov 23, 2026

    @thymikee
    Member

    Decision: accepted in direction.

    Please send the patch as a PR.

    • Use the existing build-time Apple runner environment family for automatic provisioning on real devices.
    • All three settings must be present together, and a partial set should fail with a typed signing_auth_key_incomplete reason.
    • Keep the key path and contents out of logs and runner cache metadata.
    • Document the settings under Apple runner setup.

    @strzhao your existing patch covers this scope, so please submit it as a PR against current main if you would like to carry it forward.

  3. strzhao commented on Nov 24, 2026

    @strzhao
    ContributorAuthor

    Following the accepted-in-direction call on this issue, PR #5042 has been updated (head 70086c316): the four review must-fixes are in — key path pre-validation with the typed signing_auth_key_invalid_path reason, stream scrubbing that keeps chunk-split matches scrubbed while leaving flag names and key ids in the logs, sanitized argv on every error surface (including the spawn cause's spawnargs), and the key variables stripped from the child environment — plus red-team contract tests and mutation checks, all green.

    Real-device evidence (2026-11-24, iPhone 12 Pro Max / iOS 18.1, Xcode 27.2, no Apple ID signed in) is summarized in the PR body: an automatic-signing runner build with the trio present builds, installs, and serves a snapshot on the device, and every runner.log invocation echo shows the key path scrubbed to [redacted]. One honest limit is recorded there too: this test host still holds valid local profiles from the 2026-11-13 hand test, so it cannot demonstrate the key flipping build success — that remains covered by the hand test recorded in this issue.

  4. strzhao commented on Nov 30, 2026

    @strzhao
    ContributorAuthor

    Shipped in ae0c794 (#5042): AGENT_DEVICE_IOS_AUTH_KEY_PATH / AGENT_DEVICE_IOS_AUTH_KEY_ID / AGENT_DEVICE_IOS_AUTH_KEY_ISSUER_ID as an all-three-or-none set give -allowProvisioningUpdates an App Store Connect API key on hosts with no Xcode sign-in. A partial set and an unreadable key path fail the build before it starts (signing_auth_key_incomplete, signing_auth_key_invalid_path), and the help and docs pages cover the headless setup. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions