-
Notifications
You must be signed in to change notification settings - Fork 151
fix(s2n-quic-transport): check initial dcid usage #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| .destination_connection_id_classification | ||
| .is_initial() | ||
| { | ||
| return Err(ProcessingError::Other); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add a PacketDropReason for this and emit the PacketDropped event?
|
|
||
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] | ||
| pub enum Classification { | ||
| /// The connection ID was chosen by the client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// The connection ID was chosen by the client | |
| /// The connection ID was chosen by the peer client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by this suggestion... I wanted to keep this enum generic enough that it could be used by either endpoint. So it might not always be a peer. But it will always be client-chosen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was thinking it was only used for classifying a connection ID seen on an incoming datagram
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It currently is limited to that. But I'd like it to be flexible for future uses, too.
Description of changes:
The RFC mentions that IDCIDs should only be used in Initial and Stateless Resets.
https://www.rfc-editor.org/rfc/rfc9000#section-21.2
While it's not a MUST, SHOULD, or even a MAY, it's still good to enforce. Note that this really doesn't do much to prevent a Handshake Denial of Service, since the packets that we check are using cryptographic secrets only the peers know (i.e. Handshake, Application).
Testing:
I was able to test that this check works correctly by modifying our client to ignore the server's chosen DCID in a self-talk test. However, I'm not sure if we can easily test this with the current testing framework.
In the coming weeks, I will likely be refactoring a lot of the packet processing code to decouple it from the endpoint and connection structs. During that time, I will be setting up a better test environment for unit testing these kinds of checks.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.