Skip to content

feat: complete Network demo security and migration guidance - #56

Closed
rchatham wants to merge 14 commits into
feature/network-migration-demo-securityfrom
docs/multipeer-network-migration-guide
Closed

feat: complete Network demo security and migration guidance#56
rchatham wants to merge 14 commits into
feature/network-migration-demo-securityfrom
docs/multipeer-network-migration-guide

Conversation

@rchatham

@rchatham rchatham commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

Complete the adopter-facing Network.framework migration experience on top of the production/browser checkpoint:

  • Add backend-specific Security controls to the expanded demo.
  • Map MultipeerConnectivity to Compatible/Optional Encryption or Require Encryption.
  • Map Network.framework to Unauthenticated or TLS Shared Key.
  • Strictly validate Network PSKs as Base64 with at least 32 decoded bytes and fail closed without plaintext fallback.
  • Generate in-memory test keys with SecRandomCopyBytes, including safe invalid-size and generator-failure handling.
  • Add DemoSecurityAndInteroperabilityPlan.md and a complete app-developer migration guide.
  • Add the repository-local .agents/skills/migrate-multipeer-to-network Agent Skill.
  • Refresh demo documentation and screenshots.

Security behavior

  • Multipeer required encryption does not authenticate individual peers because the demo uses a nil identity and accept-all certificates.
  • Network TLS-PSK authenticates possession of a group secret, not individual peer identity.
  • Invalid, empty, malformed, or short TLS keys block Start and never downgrade to .unauthenticated.
  • Debug PSK arguments use the same validator and are unsuitable for production secret transfer.
  • Key material is excluded from logs, exports, status text, accessibility values, and screenshots.
  • Stop preserves the current in-memory demo key; Reset drops its references. Swift does not guarantee secure erasure.

Interoperability

MultipeerConnectivity and Network.framework are not wire-compatible. Communicating peers must currently select the same backend. A future dual-stack endpoint or gateway requires a separate architecture and threat model; this PR does not claim or implement cross-backend relaying.

Migration guidance

MultipeerConnectivityToNetworkMigrationGuide.md covers deployment targets, Local Network and Bonjour setup, backend opt-in, PSK provisioning, connection behavior, API parity, physical-device testing, observability, rollout, rollback, and mixed-version constraints. The Agent Skill turns that guidance into a repeatable implementation/review workflow.

Verification

  • swift test — 175 tests passed locally.
  • xcodebuild test -project PeerConnectivity.xcodeproj -scheme PeerConnectivity -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' -configuration Debug — 175 tests passed locally.
  • Demo iPhone 16 / iOS 18.3.1 build passed.
  • Matching TLS-PSK simulator instances were previously verified to discover one another; matching/mismatched key message behavior is covered by loopback tests.
  • Markdown links and Agent Skill frontmatter were validated.
  • Correctness and security reviews found no merge blockers.

Screenshots

Multipeer security Network TLS shared key
Multipeer security controls Network TLS shared-key controls

Limitations

  • Network.framework remains experimental opt-in; MultipeerConnectivity remains the default.
  • Multipeer required encryption and Network TLS-PSK have the trust limitations described above.
  • Direct backend interoperability is unsupported.
  • Physical-device security and the complete connection-behavior matrix remain release-validation requirements.

@rchatham rchatham changed the title docs: add Multipeer to Network migration guide feat: complete Network demo security and migration guidance Aug 11, 2026
@rchatham

Copy link
Copy Markdown
Owner Author

GitHub prevents changing the base of a pull request that is registered as part of a stack. Closing this retained checkpoint so it can be recreated with the consolidated base; the branch, commits, review history, and this PR remain preserved.

@rchatham rchatham closed this Aug 11, 2026
@rchatham

Copy link
Copy Markdown
Owner Author

Replaced by consolidated PR #60: #60

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