Skip to content

fix(xpc): reject unknown peer error codes - #2241

Open
stephenlclarke wants to merge 1 commit into
apple:mainfrom
stephenlclarke:upstream/xpc-unknown-error-code
Open

fix(xpc): reject unknown peer error codes#2241
stephenlclarke wants to merge 1 commit into
apple:mainfrom
stephenlclarke:upstream/xpc-unknown-error-code

Conversation

@stephenlclarke

Copy link
Copy Markdown

Important

The commit is signed and verified.

Type of Change

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

Motivation and Context

Closes #2240.

XPC error payloads cross both a process and a version boundary. Previously, decoding an error code that the receiver did not know called ContainerizationError.Code(rawValue:), whose unknown-value path is a fatalError. A newer daemon could therefore terminate an older client simply by returning a newly introduced error code.

Validate the decoded description against the currently supported codes before constructing the error. Unknown codes now follow the existing malformed-peer-payload path and throw .internalError; known codes and messages remain unchanged.

Testing

  • Tested locally

  • Added/updated tests

  • Added/updated docs

  • Added and registered ContainerXPCTests in Package.swift.

  • swift test --filter XPCMessageTests: 2 tests passed, covering both an unknown peer code and every currently known code.

  • git diff --check: passed.

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]: Unknown XPC peer error codes can terminate the client

1 participant