Skip to content

Server Initial packets should not carry tokens - #121

Open
josephnoir wants to merge 1 commit into
apple:mainfrom
josephnoir:token-in-initial-packets
Open

Server Initial packets should not carry tokens#121
josephnoir wants to merge 1 commit into
apple:mainfrom
josephnoir:token-in-initial-packets

Conversation

@josephnoir

Copy link
Copy Markdown
Contributor

RFC 9000 says in Section 17.2.2 regarding token length:

"Initial packets sent by the server MUST set the Token Length field to 0; clients that receive an Initial packet with a non-zero Token Length field MUST either discard the packet or generate a connection error of type PROTOCOL_VIOLATION."

If I read the code correctly, the server might falsely include the issued retry token in the packet.

The RFC (17.2.2) says "Initial packets sent by the server MUST set the
Token Length field to 0; clients that receive an Initial packet with a
non-zero Token Length field MUST either discard the packet or generate
a connection error of type PROTOCOL_VIOLATION."

If I read the code correctly, the server might falsely include the
issued retry token in the packet. The change only sets the token on the
client side.
@rpaulo

rpaulo commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Isn't initialToken only set when we receive a retry? Don't we drop a RETRY from the client?

@agnosticdev

Copy link
Copy Markdown
Collaborator

Yeah, I think the issue here is that once the server receives the new initial packet and validates it in retryTokenPresent then it continues to hold onto it and so its send in the Packet.build function. You could destroy the token at that point because the packet and the token have been validated. This would probably make more sense. We will also need to change the unit tests in SwiftNetworkQUICRetryTokenTests to only validate the client token.

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.

3 participants