Repository navigation
WebTransport Swift 1.3.6
A defect-fix release. There are no wire-format changes and nothing is removed from
the public API; the additions are one new validation entry point and one new error
case. Every item was found by an adversarial audit of the codecs, the runtime and the
command-line tools, and each was reproduced before being changed. The 1.3 series code
audits were performed by Claude Opus 5.
Fixed:
-
A PKCS#12 bundle whose certificate carries explicit elliptic-curve parameters — which is what the macOS system
openssl(LibreSSL 3.3.6) emits for an EC key — no longer terminates the process.SecPKCS12Importraises an Objective-CNSInvalidArgumentExceptionin that case rather than returning a status, and because Swift cannot catch Objective-C exceptions the failure escaped everydo/catchand aborted the host application. The import now runs behind an exception boundary in a newWebTransportSecurityShimtarget, solisten(on:)throws aWebTransportNetworkRuntimeErrornaming the cause instead of killing the process. Reported in issue #20. Named-curve EC identities and RSA identities are unaffected; a bundle that previously crashed now reports: regenerate the certificate against a named curve, or use RSA. -
ServerIdentityResolvernow refuses an identity whose private key cannot be read, with the reason attached, rather than handing it to Network.framework and deferring the failure to the first peer handshake. -
.certificateChain(chainDER:privateKeyDER:keyKind:)reports why a private key was rejected. The parameter must hold the representationSecKeyCopyExternalRepresentationreturns for the private key, not the DER thatopensslwrites and not the public point: 97 bytes for P-256, 145 for P-384, and 199 for P-521. The previous failure was a bareOSStatus -50that said nothing about the encoding; the error now names the expected form and length. The required encoding is documented on the case and onmakePrivateKey, with a worked example in the wiki (issue #21). -
The PKCS#12 import error no longer repeats Security.framework's raw exception reason. It is a fixed framework string that carries nothing a caller can act on, and the project's trust rules keep framework-supplied text out of public errors. The exception name is still reported, because it is stable and useful.
-
makeFromPKCS12reads the imported identity through a type-identifier check rather than a forced cast.
Added: -
The repository's first non-Swift target,
WebTransportSecurityShim, which exists only to giveSecPKCS12Importan Objective-C frame where its exception can be converted into a status code. It is an internal target and is not part of the public product surface. -
Regression fixtures and tests for the PKCS#12 import path, using bundles generated by the macOS system
openssl. SeeSwift/Tests/WebTransportNetworkRuntimeTests/Resources/README.md. -
The CRYPTO reassembly ceiling now bounds bytes waiting for a gap rather than every byte the connection has carried. Consumed bytes are retained so a conflicting retransmission is still detected, and counting them against the ceiling made it a lifetime cap: a peer that completed a large handshake could no longer deliver a legitimate post-handshake message such as a NewSessionTicket or KeyUpdate, and was disconnected instead. The count is computed once per frame and incremented locally from there, so a large frame stays linear.
-
An accept that times out no longer consumes the next connection.
acceptSessionbounds its wait on the connection queue with a timeout, and a cancelledCheckedContinuationis never resumed, so the abandoned waiter stayed at the head of the queue and was handed the next accepted connection — which was then dropped. Reachable from the documented accept loop,while true { try await acceptSession() }, whose one-second default plants an abandoned waiter on every idle timeout; once connections arrive slower than that, every connection is lost. The queue now tags each waiter so a caller that stops waiting removes its own entry and resumes it, which lets the abandoned task unwind; dropping the continuation instead would leak it. A cancelled accept also releases a connection that arrives after it gave up. -
Shutdown now wakes a parked accept with a shutdown error instead of leaving it to block for its full timeout. That timeout was how the abandoned waiters above were created, so the two defects compounded.
-
connectSessioncancels its inbound handler task on every failure path, not only when the peer rejects the session. The handler strongly retains the connection and Network.framework exposes nocancel(), so a task left running kept the connection and its socket alive.acceptSessionalready did this. -
DATAGRAM and PING frames are no longer classified as retransmittable. RFC 9221 section 5.2 states DATAGRAM frames are not retransmitted on loss detection, and RFC 9000 section 13.3 notes a lost PING needs no repair; a caller resending everything in
retransmittableFramesre-sent an unreliable datagram and delivered it twice. -
NEW_CONNECTION_IDrejects a zero-length connection ID. RFC 9000 section 19.15 makes anything outside 1...20 aFRAME_ENCODING_ERROR, and only the upper bound was checked, so an empty connection ID was accepted and stored as a usable identity. The encoder enforces the same range, so the library can no longer produce a frame it would refuse to read. -
HKDF-Expandis capped at255 * HashLen(8,160 bytes for SHA-256) as RFC 5869 section 2.3 requires. The guard allowed up toUInt16.max, so a larger request wrapped the block counter to zero and returned bytes that look well-formed but are not the RFC's stream. -
An explicit
maxConcurrentConnectionsnow overrides a supplied admission policy instead of being silently ignored. The override was gated onadmission == .default, so a caller passing both a policy and an explicit limit had the limit dropped with no diagnostic, and an out-of-range limit was neither applied nor refused. It is now tied to the default argument value and validated on the same terms as the policy's own field. -
Long-header packets with a cleared Fixed Bit or non-zero reserved bits are rejected. RFC 9000 section 17.2 requires such packets be discarded and RFC 9001 section 5.4 requires the reserved bits to be zero; the short-header decoder enforced the Fixed Bit but the long-header path enforced neither. The Retry decoder, which is also a long header, now applies the same two checks and rejects a zero-length Retry token, which RFC 9000 section 17.2.5 requires a client to discard.
-
An oversized datagram is reported instead of being silently truncated. The UDP receive path used
recvfrom, which on this platform returns a short payload with a valid source and no indication that anything was lost — a QUIC parser would then read a packet that was never sent. It now usesrecvmsgand rejects the datagram when the kernel setsMSG_TRUNC, which is the only form that reports truncation here. Note that passingMSG_TRUNCtorecvfromdoes not work: macOS documents the flag as "data discarded before delivery", and it is set on output rather than honoured on input. -
QUICTransportParameters.validated()enforces the value rules of RFC 9000 section 18.2, which nothing did before:max_udp_payload_sizebelow 1200,ack_delay_exponentabove 20,max_ack_delayat or above 2^14,active_connection_id_limitbelow 2, astateless_reset_tokenthat is not 16 bytes, andoriginal_destination_connection_idoutside 1...20 are now rejected. A zero-lengthinitial_source_connection_idorretry_source_connection_idis accepted, because RFC 9000 section 7.3 defines that as the encoding for a selected zero-length connection ID, and an explicit zeromax_datagram_frame_sizeis accepted because RFC 9221 section 3 defines it as the default. It is opt-in rather than folded intodecode, becausedecodeis also the TLS-extension parser and must keep accepting parameters this build does not model. -
--max-sessionsis bounded at 65,536. The value sizes an array of tasks, so--max-sessions=1000000committed memory proportional to the request until the process was killed; the parser accepted any positive integer. The bound stops that abuse and is deliberately well clear ofSwift/run-soak.sh, which passesCONNECTIONS + 10. -
--listenexits non-zero when it served no sessions. It previously exited zero after every session attempt failed, which a script or CI job reads as success.
Verification
- 294 package tests, up from 280 at 1.3.5.
- Both 40-scenario conformance suites pass, from source and from the shipped
binaries. - CI green on all three jobs: build, tests and conformance; the AddressSanitizer
fuzz corpus; and the Thread Sanitizer suite. - Strict memory-safety, complete-concurrency and explicit-
Sendablediagnostics;
the formatter gate; and manifest agreement between the two package manifests. - Public API compatibility against the 1.3.0 surface.
Artifacts
| Artifact | Platform | SHA-256 |
|---|---|---|
WebTransportClient |
macOS arm64 | fa07a2a1d2c1350f3eac03507abf3fdc9e3db9bf55e00e84b61735d110965555 |
WebTransportServer |
macOS arm64 | 956b08f7547ef7049a823d9bdeb00f3294f35c9b81978d0dbffe4e02f2249af4 |
SHA256SUMS |
Checksum manifest | Included with the release |
Both are thin arm64 Mach-O and run natively on every Apple Silicon Mac. They are
ad-hoc signed rather than Developer ID signed and are not notarized, so Gatekeeper
quarantines them on first run: check the sums, then
xattr -d com.apple.quarantine WebTransportClient WebTransportServer.
The builds are reproducible. ./Swift/build-release-apple-silicon.sh performs two
clean builds and compares normalized Mach-O hashes, so these checksums can be
rebuilt from source.
Run the conformance suites from the repository root. Run from the artifact
directory, two source-tree scenarios fail because they read Package.swift and the
release script relative to the working directory.