Reject empty NEW_TOKEN frames with FRAME_ENCODING_ERROR - #151
Reject empty NEW_TOKEN frames with FRAME_ENCODING_ERROR#151rootkiller6788 wants to merge 2 commits into
Conversation
RFC 9000 Section 19.7 requires the Token field in a NEW_TOKEN frame to be non-empty, and a client MUST treat receipt of a NEW_TOKEN frame with an empty Token field as a connection error of type FRAME_ENCODING_ERROR. quiche currently parses an empty token successfully and delivers it to the connection, leaving the connection open. Reject the empty token in the framer and raise QUIC_INVALID_FRAME_DATA, which maps to FRAME_ENCODING_ERROR on the wire. Update existing tests that used empty NEW_TOKEN frames as a convenience so they exercise non-empty tokens, and add a framer test covering the empty-token rejection.
|
Hello, I've addressed the current merge state by syncing this branch with the latest upstream |
Summary
RFC 9000 Section 19.7 requires the Token field in a NEW_TOKEN frame to be non-empty, and a client MUST treat receipt of a NEW_TOKEN frame with an empty Token field as a connection error of type FRAME_ENCODING_ERROR.
quiche currently parses an empty token successfully and delivers it to the connection visitor, leaving the connection open (the token is later silently ignored by the TLS handshaker).
Change
In
QuicFramer::ProcessIetfFrameData, afterProcessNewTokenFramesucceeds, reject an empty token withQUIC_INVALID_FRAME_DATA, which maps toFRAME_ENCODING_ERRORon the wire (seeQuicErrorCodeToTransportErrorCode).Tests
QuicFramerTest.NewTokenFrameEmptyToken, which verifies a NEW_TOKEN frame with a zero-length Token is rejected withQUIC_INVALID_FRAME_DATA.NewTokenFrameInstigateAcks,ServerClosesConnectionOnNewTokenFrame, andAckElicitingFramesto use a non-empty token, since an empty token is now correctly rejected before reachingQuicConnection::OnNewTokenFrame.The server's own NEW_TOKEN send path (
QuicSession::SendNewToken) always writes a non-empty token (it prepends akAddressTokenPrefixbyte and returns early if the address token is empty), so this change does not affect the legitimate send path.Closes #135 (and the duplicate #133).