Skip to content

Validate XPC peers with xpc_connection_get_euid instead of the non-public audit-token API - #2091

Open
devops-thiago wants to merge 1 commit into
apple:mainfrom
devops-thiago:xpc-euid-public-api
Open

Validate XPC peers with xpc_connection_get_euid instead of the non-public audit-token API#2091
devops-thiago wants to merge 1 commit into
apple:mainfrom
devops-thiago:xpc-euid-public-api

Conversation

@devops-thiago

Copy link
Copy Markdown

Fixes #2087.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

#896 added same-EUID validation of XPC peers by reading each message's audit token via xpc_dictionary_get_audit_token. That symbol is not in the public XPC headers — the CAuditToken target exists solely to re-declare its prototype — and App Store Connect rejects binaries that reference it (see #2087 for the verbatim rejection), which blocks anyone redistributing these executables inside a reviewed app.

Description

The check's purpose (client EUID == server EUID) is served by public API: for a launchd Mach service, every peer arrives on its own connection, so the connection's credentials and the message sender's are the same identity, and xpc_connection_get_euid is the documented way to read them.

  • XPCServer.handleMessage reads the peer EUID from the connection.
  • The CAuditToken shim target is deleted along with its libbsm link dependency; Package.swift references removed.

Net: 9 insertions, 52 deletions, no behavior change to the enforcement.

Testing

  • swift build clean on this branch at abff418; nm -u container-apiserver shows zero audit_token references afterwards.
  • We run this change in production in a GUI embedder of this engine: the same-user gate demonstrably still admits legitimate peers (an end-to-end suite of ~95 checks crosses it on every request) — and the previously rejected App Store submission passed the non-public-API scan with it.

App Review rejects binaries referencing xpc_dictionary_get_audit_token, which
is not public API — the CAuditToken target existed solely to declare its
prototype. The check it fed is a same-EUID gate on every request.

The connection already knows the answer. For a launchd Mach service each peer
arrives on its own connection, so the connection's credentials and the message
sender's are the same identity, and xpc_connection_get_euid is the documented
way to read them. Same enforcement, public API, and a whole C shim target
gone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: XPC peer validation uses non-public API xpc_dictionary_get_audit_token, blocking App Store redistribution

1 participant