Skip to content

fix(relay): apply host Unix socket permissions - #909

Open
stephenlclarke wants to merge 1 commit into
apple:mainfrom
stephenlclarke:upstream/unix-socket-relay-permissions
Open

fix(relay): apply host Unix socket permissions#909
stephenlclarke wants to merge 1 commit into
apple:mainfrom
stephenlclarke:upstream/unix-socket-relay-permissions

Conversation

@stephenlclarke

Copy link
Copy Markdown
Contributor

Summary

Apply UnixSocketConfiguration.permissions when an .outOf UnixSocketRelay creates its host-side listener.

The .into path already forwards the configured mode to UnixType, but .outOf omitted it and therefore used the process-default socket mode. A caller requesting a private endpoint such as 0600 could receive broader permissions than requested.

Extract the host-listener construction into a package-visible helper so the filesystem contract can be tested without a VM, pass the optional mode through, and close the new socket if listen() fails.

Testing

swift test --filter UnixSocketRelayTests

Result: 1 focused regression passed, verifying that an .outOf relay configured with 0600 creates a host socket with mode 0600.

Compatibility

Callers that omit permissions keep the existing default. Callers that provide a mode now receive the documented behavior consistently in both relay directions.

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.

1 participant