Skip to content

webtransport: port in :authority, any 2xx opens a session, exportKeyingMaterial - #50

Merged
endel merged 4 commits into
mainfrom
wt-authority-2xx-exporter
Dec 1, 2026
Merged

endel merged 4 commits into
mainfrom
wt-authority-2xx-exporter

Conversation

@endel

@endel endel commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Three things porth's web-platform-tests run found in a WebTransport client. One commit, 187 lines added across five source files plus the changelog and a spec note.

What changes

  • :authority carries the port. The CONNECT named the host alone. It now adds the port unless that is 443, and brackets an IPv6 host (authorityOf in src/event_loop.zig). Client keeps the configured port for this.
  • Any 2xx opens a session. Only 200 did, so a 204 was reported as session_rejected (src/webtransport/session.zig).
  • exportKeyingMaterial. New on ClientSession and Session, by draft-ietf-webtrans-http3 section 4.8: a TLS exporter labelled EXPORTER-WebTransport, its context the session id followed by the application's label and context, each behind a length byte. Beneath it:
    • KeySchedule derives exporter_master_secret alongside the application traffic secrets (src/quic/tls13.zig).
    • tls13.exportKeyingMaterial is RFC 8446 section 7.5's exporter, SHA-256 only, up to 255 * 32 bytes.
    • Connection copies the secret when the application keys install, so it outlives the handshake's release, and exposes Connection.exportKeyingMaterial for any QUIC connection.

Worth a reviewer's eye

  • SPEC/webtransport_w3c_api.md had exportKeyingMaterial() as "skip until a second engine wants it". This PR implements it anyway, for porth, and rewrites that row. Say if the skip should stand.
  • The exporter context layout was checked against draft-ietf-webtrans-http3-14 section 4.8. No peer has confirmed the bytes: the web-platform-tests only check that exports are deterministic and differ by label, context and session, and the unit tests check the two ends of one handshake against each other.
  • authorityOf falls back to the bare host when the result would not fit its buffer (253 bytes of host plus brackets and port).
  • The secret is copied in the block that sets up the key-update manager, which runs once computed_app is true. A path that completes the handshake without reaching that block would leave exportKeyingMaterial returning error.NotReady.

Tests

New unit tests:

  • authorityOf: port, 443, IPv6 with and without brackets.
  • exportKeyingMaterial: the two HKDF steps against std's hkdfExpandLabel, and the length and label limits.
  • The loopback handshake helper now also checks that client and server export the same bytes, and different ones for another label or context.
  • A client's session opens on a 204.

Run on Windows only (zig 0.17.1):

  • zig build test: the new tests pass. One full run had 1 failure in 1382 and the rerun had none, so that one is intermittent; I did not catch which test it was.
  • porth's web-platform-tests against this branch: the 6 connect.https failures and the 15 export-keying-material ones pass, with no other test changing.

Not run: macOS, Linux, the interop runner, and routez's e2e suite.

🤖 Generated with Claude Code

endel added 4 commits December 1, 2026 01:53
…ngMaterial

Three things porth's web-platform-tests run found in a client:

- The CONNECT's :authority was the host alone. It now carries the port
  unless that is 443, and brackets an IPv6 host.
- Only a 200 opened a session. Any 2xx does (RFC 9114 section 4.4).
- exportKeyingMaterial on ClientSession and Session, the exporter of
  draft-ietf-webtrans-http3 section 4.8, over a TLS exporter
  (RFC 8446 section 7.5) that Connection keeps the secret for past the
  handshake's release.

Assisted-by: Fable 5.2
It exported for any id, so a closed or mistyped session got keying
material nobody else could derive.

The 2xx rule is draft-ietf-webtrans-http3 §3.2's, not RFC 9114 §4.4's,
which is about a plain CONNECT. The exporter is written up in SPEC, with
the caveat that no other implementation's export has been compared.

Assisted-by: Claude Fable 5.2
@endel
endel merged commit 88939af into main Dec 1, 2026
4 checks passed
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