Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves POSIX transport security and robustness by tightening shared-memory permissions, adding a compile-time MTU/packet-size invariant, and strengthening TLS socket/SSL cleanup on failure paths.
Changes:
- Reduced shared memory creation permissions from world-writable to group-writable (0666 → 0660).
- Added a compile-time assertion to ensure TLS packet size matches the communication MTU.
- Ensured TLS listen/init and recv error paths close file descriptors and reset context state to avoid leaks/dangling fds.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| port/posix/posix_transport_tls.c | Adds compile-time size check; improves TLS listen/init and recv cleanup to close fds and reset fields on failures. |
| port/posix/posix_transport_shm.c | Tightens shared memory creation mode to reduce unnecessary permissions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bigbrett
approved these changes
Mar 24, 2026
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.
This pull request focuses on improving security, safety, and resource management in the POSIX transport code, particularly for TLS and shared memory transports. The main areas of change include stricter file permissions, enhanced compile-time safety checks, and more robust handling of file descriptors to prevent resource leaks and errors.
Security and Safety Improvements:
posix_transport_shm.cfrom0666(world-writable) to0660(group-writable only), reducing unnecessary permissions.posix_transport_tls.cto ensure thatPTTLS_PACKET_MAX_SIZEandWH_COMM_MTUare always equal, preventing potential buffer overflows during TLS operations.Resource Management and Error Handling:
posixTransportTls_SendRequest,posixTransportTls_RecvRequest, and related functions by ensuring file descriptors are properly closed and context fields are reset to0on failure, preventing resource leaks and dangling references. [1] [2] [3] [4]posixTransportTls_InitListento ensure that both the SSL context and the underlying TCP context are cleaned up if initialization fails, avoiding partial resource leaks. [1] [2]