Skip to content

Conversation

@camshaft
Copy link
Contributor

@camshaft camshaft commented Sep 19, 2023

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

Except for Initial and Stateless Resets, an endpoint only accepts packets that include a Destination Connection ID field that matches a value the endpoint previously chose.

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.

@camshaft camshaft marked this pull request as ready for review September 19, 2023 19:13
.destination_connection_id_classification
.is_initial()
{
return Err(ProcessingError::Other);
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The connection ID was chosen by the client
/// The connection ID was chosen by the peer client

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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.

@camshaft camshaft enabled auto-merge (squash) September 20, 2023 16:51
@camshaft camshaft merged commit 999dd55 into main Sep 20, 2023
@camshaft camshaft deleted the camshaft/idcid-check branch September 20, 2023 17:13
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.

2 participants