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
Open
Validate XPC peers with xpc_connection_get_euid instead of the non-public audit-token API#2091devops-thiago wants to merge 1 commit into
devops-thiago wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2087.
Type of Change
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 — theCAuditTokentarget 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_euidis the documented way to read them.XPCServer.handleMessagereads the peer EUID from the connection.CAuditTokenshim target is deleted along with itslibbsmlink dependency;Package.swiftreferences removed.Net: 9 insertions, 52 deletions, no behavior change to the enforcement.
Testing
swift buildclean on this branch at abff418;nm -u container-apiservershows zeroaudit_tokenreferences afterwards.