Skip to content

Secure Network backend transport with PSK - #32

Closed
rchatham wants to merge 2 commits into
feature/network-migration-local-loopbackfrom
feature/network-migration-secure-transport
Closed

Secure Network backend transport with PSK#32
rchatham wants to merge 2 commits into
feature/network-migration-local-loopbackfrom
feature/network-migration-secure-transport

Conversation

@rchatham

@rchatham rchatham commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an authenticated encrypted option for the experimental Network framework backend using TLS pre-shared keys, and updates loopback coverage to exercise the secured path.

Changes

  • Add public PeerConnectionNetworkSecurity:
    • .unauthenticated preserves source-compatible plaintext diagnostics/migration behavior.
    • .preSharedKey(Data) configures TLS-PSK for Network framework connections.
  • Add networkSecurity: to PeerConnectionManager with default .unauthenticated.
  • Thread Network security configuration through the Network transport factory, session transport, browser, listener, and outbound connections.
  • Configure NWParameters with TLS options and sec_protocol_options_add_pre_shared_key when .preSharedKey is selected.
  • Update README and API docs with the secured opt-in example and plaintext caveat.
  • Update loopback E2E test to use TLS-PSK.
  • Add negative coverage that mismatched PSKs do not connect.
  • Add coordinator negative tests for unsupported handshake versions and duplicate identity spoof attempts.

Verification

  • swift test --filter NetworkPeerCoordinatorTests — passed
  • swift test --filter NetworkPeerLoopbackTests — passed
  • swift test — 98 tests passed
  • xcodebuild test -project PeerConnectivity.xcodeproj -scheme PeerConnectivity -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' -configuration Debug — 98 tests passed
  • GitHub Actions pull_request CI — Swift Package Tests and Xcode Project Tests passed
  • GitHub Actions push CI — Swift Package Tests and Xcode Project Tests passed after rerunning an initial Xcode job failure
  • Correctness reviewer — no remaining merge-blocking findings; matched-key loopback passed locally, resolving the only functionality concern raised
  • Security reviewer — no merge-blocking security findings

Notes / limitations

  • .networkFramework remains opt-in and still lacks streams/resource/UI parity.
  • .unauthenticated remains available for source compatibility and diagnostics, but docs explicitly mark it as plaintext and not for sensitive data.
  • This PR addresses the first security hardening slice. Follow-ups should add connection hardening: handshake timeout, connection caps, backoff/retry, and stricter cleanup behavior.

Stack context

Stacked on PR #31 (feature/network-migration-local-loopback). This is the secure transport hardening slice of the Network migration stack.

…loopback' into HEAD

# Conflicts:
#	Sources/PeerConnectionManager.swift
#	Sources/PeerConnectionTransports.swift
@rchatham

Copy link
Copy Markdown
Owner Author

Superseded by consolidated PR #42. No commits were discarded; this branch is preserved as a recovery and reference point. Addressed review findings were replied to and resolved before consolidation.

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