Repository navigation
Open
Conversation
…th missing_extension instead of aborting the process (#639) RFC 9001 8.2 makes a ClientHello without the quic_transport_parameters extension a missing_extension alert. ngtcp2's picotls glue passes the extension on only when it is there and returns 0 when it is not, so the handshake went on without the client's transport parameters. A server learns its negotiated version from them, and ngtcp2 checks that they arrived only once the handshake completes; the first 1-RTT packet the server wrote before then failed assert(conn->negotiated_version), which ngtcp2 keeps in Release builds, and aborted the process. The shim now wraps the collected_extensions callback that ngtcp2_crypto_picotls_configure_server_session installs: without the extension among those collected, which includes a hello carrying only the draft codepoint 0xffa5, it returns PTLS_ALERT_MISSING_EXTENSION, and the connection closes. libioxide_ngtcp2.so rebuilt for linux-x64 and linux-arm64 at the pinned refs. QuicTransportParameterTests: a hand-built ClientHello without the extension, and one with only 0xffa5, are refused, and the same server then answers a well-formed one. With the previous libioxide_ngtcp2.so the first of them aborted the test host at ngtcp2_conn.c:3633.
This branch has not been deployed
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.
Fixes #639.
A ClientHello without the
quic_transport_parametersextension, or with only the draft codepoint 0xffa5, aborted the process: one Initial packet from anyone took an HTTP/3 server down (ngtcp2_conn.c:3633: conn_write_pkt: Assertion 'conn->negotiated_version' failed). h3spec v0.1.15's twomissing_extension [TLS 8.2]cases did it every time, and every case after them then failed against a dead server, which is what HttpArena's genhttp-ioxide shows as "crashed".Why. ngtcp2's picotls glue (
ngtcp2_crypto_picotls_collected_extensions) hands the extension on when it is there and returns 0 when it is not, so picotls finished the server's side of the handshake without the client's transport parameters. A server takes its negotiated version from them, and ngtcp2 checks they arrived only at handshake completion, after the server's first 1-RTT packet has already asserted on the version. ngtcp2 keeps assertions in Release builds on purpose. The gap is ngtcp2's and is still on its main.The change.
iq_collected_extensionsin the shim, installed right afterngtcp2_crypto_picotls_configure_server_session: it calls ngtcp2's function whenquic_transport_parametersis among the collected extensions, and otherwise returnsPTLS_ALERT_MISSING_EXTENSION, the alert RFC 9001 8.2 requires. picotls calls it with whatever it collected, an empty list included, so the draft-only hello is refused too. picotls's glue turns the alert into NGTCP2_ERR_CRYPTO, and the connection closes as any failed handshake does. Server only: a client already fails at handshake completion on a server that leaves them out, and has no 1-RTT packet to write before then.libioxide_ngtcp2.sorebuilt for linux-x64 and linux-arm64 withscripts/build-ngtcp2-native.shat the pinned refs, GCC 13.3 on Ubuntu 24.04 (arm64 cross-built in an ubuntu:24.04 container). Both still need GLIBC_2.38 and export the same 35iq_functions.What a caller notices. Such a hello now gets a CONNECTION_CLOSE and the server goes on serving. Until #638 the close carries PROTOCOL_VIOLATION rather than CRYPTO_ERROR 0x16d. No managed API changes.
Tests.
QuicTransportParameterTests(E2E, new): a hand-built ClientHello without the extension, and one carrying only 0xffa5, are closed without a ServerHello, and the same server then answers a well-formed hello with a ServerHello.QuicSniHostileTests.Hellotakes which transport parameters extension to carry (v1 by default, so its own tests send what they sent), and its engine and server fixtures are shared.Seen failing without the change: with the previous
libioxide_ngtcp2.soin the test output, the first new test aborted the whole test host with the same assertion (exit 134). The SNI tests before it passed.Suites (linux-x64): Unit 306/0/0, E2E 799/0/0, Chaos 105/0/0. linux-arm64 has only been built here, not run; CI's arm64 leg runs it.
For review. The arm64 build needed several attempts on this machine: gcc hit internal compiler errors at full parallelism, and it built cleanly on 4 cores. Worth a glance that CI's arm64 leg is green.